DEFINE

 

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.

 

DEFINE lets you assign labels to existing variables, values, or logic statements.

 

Syntax:

DEFINE label = variable, value, or logic statement

 

Abbreviation: DEF

 

Usage:

You can simplify your table, filter and banner logic by using DEFINE to label variables, values or logic statements. For example, you can label a complicated logic statement and substitute that label for the statement when you write logic. In wave studies, such labels can be useful because data locations might change but your table, filter and banners probably would not. If you have defined variables, you could simply edit the reference to the data locations in the glossary statement.

 

Note:

1. Use caution when defining variables with complex logic and using with LOC+ or VAR+ banners or tables. For example: DEFINE MARKET = {{CITY (1,3) AND STATE (1)} OR CITY (2)}

2. Column locations must be preceded by the record number even if the data only has one record. For example: DEFINE NEWUSER = 1/20

3. Use descriptive labels for variables and bases. Do not use single-letter labels and words that might conflict with WinCross Reserved Key Words such as MEAN, NET or DEFINE.

4. When writing glossary variables, you can use the offset mode only with DEFINE statements and IF conditions.

 

Offset Mode:

You can specify logic without specifying the record each time. You can use record image or offset mode (also called position orientation). For example, the record image: 1/20 can be represented as: 20. If you have two records, each with 80 positions, and you want to refer to the second record, tenth position, the record image would be: 2/10 and the offset mode would be: 90.

For example, you can write:

 

DEFINE Q20 = 1/32 (record image) or
DEFINE Q20 = 32 (offset mode)

Note: Variables defined in the Glossary with simple logic (for example, DEFINE NEW_VAR = 1/75) can be used in Simple Weighting, Sample Balancing or Factor Analysis if the Use glossary transformations option is enabled.

DEFINE examples

Related topics:

Glossary Variables

DECLARE

DECLARE Examples