• <GetStart>
  • CSPro User's Guide
    • The CSPro System
    • Data Dictionary Module
    • The CSPro Language
    • Data Entry Module
    • Batch Editing Applications
    • Tabulation Applications
    • Data Sources
    • CSPro Statements and Functions
      • Statement Format Symbols
      • Alphabetical List of Functions and Statements
      • List of Reserved Words
      • Deprecated Features
      • Declaration Statements
        • Numeric Statement
        • String Statement
        • Alpha Statement
        • config Variable Modifier
        • ensure Variable Modifier
        • persistent Variable Modifier
        • Visual Values for Numeric Fields
        • Relation Statement
        • Function Named Arguments
        • Function Statement
        • Optional Function Parameters
        • Passing Function Arguments by Reference
        • Additional Examples of User-Defined Functions
        • Dot Notation, Logic Objects, and Namespaces
      • Symbol Functions
      • Item Functions
      • Array Object
      • Audio Object
      • Barcode and QR Codes
      • Case Object
      • Document Object
      • File Object
      • Freq Object
      • Geometry Object
      • HashMap Object
      • Image Object
      • List Object
      • Map Object
      • Path
      • Pff Object
      • SystemApp Object
      • ValueSet Object
      • Program Control Statements
      • Assignment Statements
      • Data Entry Statements and Functions
      • Batch Edit Statements
      • Numeric Functions
      • String Functions
      • Multiple Occurrence Functions
      • General Functions
      • Date and Time Functions
      • External File Functions
      • Synchronization Functions
    • Templated Reporting System
    • HTML and JavaScript Integration
    • Action Invoker
    • Appendix
  • <CSEntry>
  • <CSBatch>
  • <CSTab>
  • <DataViewer>
  • <TextView>
  • <TblView>
  • <CSFreq>
  • <CSDeploy>
  • <CSPack>
  • <CSDiff>
  • <CSConcat>
  • <Excel2CSPro>
  • <CSExport>
  • <CSIndex>
  • <CSReFmt>
  • <CSSort>
  • <ParadataConcat>
  • <ParadataViewer>
  • <CSCode>
  • <CSDocument>
  • <CSView>
  • <CSWeb>

Relation Statement

 

Format:

relation relation-name primary to secondary-1 method

[to secondary-2 method] ... [to secondary-n method];

 

where method is

 

   parallel | linked by arith-exp | where condition

  

Description:

The relation statement allows you define additional relations beyond those defined in the data dictionary.

 

The relation-name is a unique CSPro name which contains only letters, numbers, or the underscore ('_') character. It must begin with a letter.

 

The primary is the name of a multiply occurring record or item. Items defined as secondary are linked to the primary by the method specified.

 

The secondary is the name of a multiply occurring record or item which is linked to the primary.

 

The method type is specified by one of the keywords parallel, linked by, or where.

 

In the parallel method corresponding occurrences of the primary record or item and secondary record or item are linked, that is first occurrences are linked, second occurrences are linked and so on.

 

In the linked by method the value of the arithmetic expression containing values from one record item is a pointer to the occurrence in the other record or item.

 

In the where method the value of an item on the primary record is compared to the value of an item on the secondary record. If the values are equal, the records are linked.

 

Example 1:

PROC GLOBAL

  relation PERSON POP1 to POP2 parallel

      to POP3 parallel;

 

Example 2:

PROC GLOBAL

  relation MOTHER-CHILD CHILD to MOTHER linked by MOTHER_LINE;

 

Example 3:

PROC GLOBAL

  relation MOTHER-ALL PERSON to MOTHER

      where PERSON_LINE = MOTHER_LINE;