DEFINE Examples

 

IMPORTANT: WinCross 15 and earlier versions use DEFINE, ASSIGN and COMPUTE to create new variables and assign or compute values into the new variables. Beginning with WinCross 16, you can now use the DECLARE instruction to create new variables and assign and compute values directly into the new variables without using ADDLEN.

 

Example 1: Define a variable label

 

DEFINE AGE = 1/261

 

means, ‘Use the label ‘AGE’ to define the location of record 1, column 261.’ After this variable is defined, you can substitute the word AGE in your logic statement anywhere you want to reference record 1, column 261.

 

 

Example 2: Define a variable and value label

 

DEFINE MALES = GENDER (1)

 

means, ‘Use the variable MALES to represent variable GENDER, value 1.’ After this variable is defined, you can substitute the word MALES for the location and value of GENDER (1).

 

 

Example 3: Define a label for an often-used complex logic statement

 

DEFINE BRANDA = {Q2A (1) OR {Q3A (1) AND OLD_BRAND (1)}}

 

means, ‘Use the variable BRANDA to represent variable Q3A, value 1 and variable OLD_BRAND, value 1 or Q2A, value 1.’ After this variable is defined, you can substitute the word BRANDA for the complex logic statement.

 

IMPORTANT: When using complex logic to define a label in the glossary, the entire logic statement should be enclosed in brackets.

Related topics:

DEFINE