# Logic Examples

Multi-column fields are indicated by a colon:

Example (ASCII data):

1/5:2 (12)

represents, ‘record 1, starting in column 5, a 2-column field, value 12.’ The number following the colon indicates the field width. When no colon is included, a 1-column field width is assumed.

A range of values is indicated by a hyphen:

Example 1 (Variable data):

Q6 (12-14)

represents, ‘variable Q6, value of 12 OR 13 OR 14.’ The hyphen between values indicates that a range of values will satisfy this statement. The hyphen represents OR logic.

Example 2 (ASCII data):

1/5:2 (12-14)

represents, ‘record 1, columns 5 and 6 (2-column field), value of 12 OR 13 OR 14.’ The hyphen between values indicates that a range of values will satisfy this statement. The hyphen represents OR logic.

 Note: When the range of values involves negative numbers you must enter the smaller negative number at the beginning of the range.

Example 3 (Variable data):

Q6 (-4--1)

represents, ‘variable Q6, value of -4 OR -3 OR -2 OR -1.’ The hyphen between values indicates that a range of values will satisfy this statement. The hyphen represents OR logic.

Example 4 (ASCII data):

1/5:2 (-4--1)

represents, ‘record 1, columns 5 and 6 (2-column field), value of -4 OR -3 OR -2 OR -1.’ The hyphen between values indicates that a range of values will satisfy this statement. The hyphen represents OR logic.

 Note: When the range of values involves alpha-numeric code values, the code value on both sides of the hyphen must be the same number of characters. (For example, WinCross can correctly evaluate SEGMENT (A-D) or SEGMENT (AA-DD) but CANNOT correctly evaluate SEGMENT (A-DD) or SEGMENT (AA-D)). Care should be taken to check table results when using the range of values in logic where the code values are alpha-numeric.

Example 5 (Variable data):

SEGMENT (A-D)

Non-consecutive values are separated by commas:

Example 1 (Variable data):

Q10A (3,13-20,23)

represents, ‘variable Q10A, value of 3 OR 13 OR 14 OR 15 OR 16 OR 17 OR 18 OR 19 OR 20 OR 23.’

Example 2 (ASCII data):

3/23:2 (3,13-20,23)

represents, ‘record 3, columns 23 and 24 (2-column field), value of 3 OR 13 OR 14 OR 15 OR 16 OR 17 OR 18 OR 19 OR 20 OR 23.’

Example 3 (Variable data):

Q11_1 (2,7)

represents, ‘variable Q11_1, value of 2 OR 7.’

Example 4 (Variable data):

Q1 ( ,9)

represents, ‘a value of blank OR 9 for variable Q1.’

Example 5 (ASCII data):

3/43 (2,7)

represents, ‘record 3, column 43, value of 2 OR 7.’

Blanks are indicated by spaces:

Example 1 (Variable data):

AGE ( )

represents, ‘variable AGE, a blank value.’ Use a space in parentheses when testing a blank value. Only one space is required for multi-column variables.

Example 2 (ASCII data):

1/5:2 ( )

represents, ‘record 1, columns 5 and 6 (2-column field), a blank value.’ Use a space in parentheses when testing a blank value. Only one space is required for multi-column fields.

Related topics:

Basic syntax

Logic Structure

Reserved Key Words