Quick Reference

 

LOGIC QUICK REFERENCE

 

BASIC SYNTAX

VARIABLE (VALUE)

VARIABLE (VALUE1-VALUE2, VALUE3, VALUE4...)

Variable data examples:

A range of values is indicated by a dash:  Q1 (12-14)

Non-consecutive values are separated by commas:  Q6 (3,13-20,23)

Blanks are indicated by spaces:  Q1 ( )

 

RECORD/COLUMN (VALUE)

RECORD/COLUMN:WIDTH (VALUE1-VALUE2, VALUE3, VALUE4...)

ASCII data examples:

Multi-column fields are indicated by a colon (ASCII data):  1/5:2 (12)   

A range of values is indicated by a dash (ASCII data):  1/5:2 (12-14)

Non-consecutive values are separated by commas (ASCII data):  3/23:2 (3,13-20,23)

Blanks are indicated by spaces (ASCII data):  1/5:2 ( )

 

For ASCII files, offset mode can be used:  1/20 can be 20;  2/10 (1) can be 90 (1). With Glossary Variables, offset mode can be used only with DEFINE and IF.

 

(VALUE) can be 0-9, A-Z (upper case only), negative numbers and decimal numbers.

 

LOGICAL OPERATORS AND BRACES  

AND (&)

AND NOT (&?)

NOT (?)

OR (!)

 

= (equal to)

> (greater than)

< (less than)

>= (greater than or equal to)

and <= (less than or equal to)

 

Braces { } indicate which expressions should be evaluated together and the order in which the expressions should be considered.   

 

SPECIAL FEATURES

Scan (S) can take place of OR logic for searching multiple columns and fields:

 

Variable data examples:

You can S single columns:  Q1_A S3 (Y)

You can S for multiple values: Q2A S3 (66,67)

Use the Skip (+) with S for non-contiguous columns or fields: Q3A S3+1 (9) would scan across 3 variables skipping one column in between (i.e. if Q3A through Q3E were contiguous and one column each, this instruction would scan Q3A, Q3C and Q3E for a value of "9", skipping variables Q3B and Q3D).

 

ASCII data examples:

You can S single columns:  1/35 S3 (Y)

You can S for multiple values: 1/35:2 S3 (66,67)

Use the Skip (+) with S for non-contiguous columns or fields: For example:  2/15 S3+1 (9) to scan columns 15, 17, and 19

Everywhere (E) can take place of AND logic for searching multiple columns and fields:

 

Variable data examples:

You can use E across multiple fields:  Q10 E3 (122)

You can use E for multiple values:  Q10 E3 (1,2)

Use the Skip (+) with E for non-contiguous columns or fields: Q11A E3+1 (9) would search across 3 variables skipping one column in between (i.e. if Q11A through Q11E were contiguous and one column each, this instruction would search variables Q11A, Q11C and Q11E for values of "9" skipping variables Q11B and Q11D).

 

ASCII data examples:

You can use E across multiple fields:  1/35:3 E3 (122)

You can use E for multiple values:  1/35 E3 (1,2)

Use the Skip (+) with E for non-contiguous columns or fields: 2/15 E3+1 (9) to search columns 15, 17, and 19

 

SPECIAL LOGIC INSTRUCTIONS

NET lets you show the total cases included in groups of rows.  For example: NET  2

NET- lets you show the total cases included in previous rows. For example NET-2

NET/ENDNET lets you show the total cases included in groups of rows between the NET and ENDNET lines.

For example: NET

 Row1

 Row2

 ENDNET

SUB (subtotal) lets you the show the total number of mentions. For example: SUB 3

SUB- lets you show the total number of mentions from previous rows. For example SUB-2

LOC lets you create Line Tables using ASCII or variable data. You reference a starting location and then add (or subtract) a number that increments that location for the next row or banner. For example:  LOC + 5

VAR lets you create Line Tables using variable data. You reference a starting variable and then add (or subtract) a number that increments that variable for the next row or banner. For example:  VAR + 5

CALC lets you perform calculations on your table results. For example: CALC F2 + F3 (this row would show the sum of the frequencies from row 2 and row 3.)

 

SPECIAL VALUE FEATURES

# (pound sign) to use a different value to calculate statistics.   

 

Variable data example:

Examples: Q4A (1-5) # 1=5, 2=4, 4=2, 5=1  or  Q4A (14) # 10

 

ASCII data example:

Examples: 1/8 (1-5) # 1=5, 2=4, 4=2, 5=1  or  1/8:2 (14) # 10

 

@ (at sign) to select a range of values for Grouped Medians:  

 

Variable data example:

AGE @ 25-34  

 

ASCII data example:

1/10 (2) @ 25-34  

 

GLOSSARY VARIABLES QUICK REFERENCE

 

DECLARE lets you create a new variable in the Glossary and to assign or compute values into the new variable.

 

Syntax:

DECLARE new variable

DECLARE new variable,new variable,new variable

DECLARE new variable = variable

DECLARE new variable = value

DECLARE new variable = variable (or record/column) operator variable (or record/column)

DECLARE new variable = variable (or record/column) operator value

 

(where n specifies the width of the new variable; with a maximum width of 12)

DECLARE new variable:n                                                           

DECLARE new variable:n,new variable:n,new variable:n

DECLARE new variable:n = variable

DECLARE new variable:n = value

DECLARE new variable:n = variable (or record/column) operator variable (or record/column)

DECLARE new variable:n = variable (or record/column) operator value

 

ADDREC lets you add one or more records to each case.

Syntax:   ADDREC  number of additional records

ADDREC must appear before other glossary variables.

 

ADDLEN lets you add columns to each record.

Syntax: ADDLEN  number of additional columns

ADDLEN must appear before other glossary variables.

 

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

Syntax:   DEFINE  label  =  variable, value, or logic statement

DEFINE label can be up to 64 characters.

Use underscores to indicate blanks. For example:  Q5_AGE

 

Some Glossary statements can be written using IF/ELSE logic to allow for handling multiple IF conditions.

 

RECODE lets you change variable values.

Syntax:  RECODE record/column:width (old value=new value)

RECODE replaces the original value with the new value. You can use IF logic with RECODE.

Repeat (R)  lets you apply RECODE to multiple columns or variables.

Variable data example:

RECODE Q1A R20 (1=5,2=4,4=2,5=1)

ASCII data example:

RECODE 1/13 R20 (1=5,2=4,4=2,5=1)

 

ASSIGN lets you assign a value or a location's contents to a new or existing location. The ASSIGN keyword is optional unless preceded by IF logic.

Variable data example:

Syntax 1:  

ASSIGN variable = (value)

or

variable = (value)

 

Syntax 2:

ASSIGN new variable = original variable

or

new variable = original variable

Repeat (R) lets you apply ASSIGN to multiple variables.

For example:

ASSIGN Q1_A R3+1=(1)

or

Q1_A R3+1=(1)

 

ASCII data example:

Syntax 1:

ASSIGN record/column:width = (value)

or

record/column:width = (value)

 

Syntax 2:

ASSIGN new record/column:width = original record/column:width

or new record/column:width = original record/column:width

With ASCII data, ASSIGN  overwrites the original value with the new value. You can use IF logic with ASSIGN. The ASSIGN keyword is required when it is preceded by IF logic.

Repeat (R) lets you apply ASSIGN to multiple columns.

For example:

ASSIGN 2/12 R3+1=(1)

or

2/12 R3+1=(1)

 

COMPUTE lets you perform mathematical computations.

Variable data examples:

Syntax 1:  COMPUTE new variable = variable operator variable

Syntax 2:  COMPUTE new variable = original variable operator value

 

COMPUTE Q6A_TOTAL = Q6A_1 + Q6A_2

COMPUTE INCOME * 10

 

ASCII data examples:

Syntax 1:  COMPUTE new variable = record/column operator record/column

Syntax 2:  COMPUTE new variable = record/column operator value

 

COMPUTE 1/24:3 = 1/54:2 + 1/57:2

COMPUTE 1/100:6 * 10

There must be a space before and after an operator.  Make sure field accommodates length of new variable, including decimal places. You can add (+), subtract (-), multiply (*), and divide (/). You can use IF logic with COMPUTE.

 

The COMMENT Symbol: * (asterisk) lets you include comments for your reference.

Syntax: *  text

 

TEST lets you create statements for data exploration.

Syntax:  TEST label = logic statement for test condition

 

LOOP/ENDLOOP allows you to code multiple glossary statements using a LOOP command.

Syntax:  LOOP #,VariableName = Initial Value(Increment)

             .................................................

             ENDLOOP

where # = the number of times to perform the LOOP command. There can be 0 or more comma-delimited variables on the LOOP line.

The VariableName portion of the glossary looping logic (shown above) can only contain alpha characters and is alphabetically incremented (i.e. A, B, C, ....., Z, AA, AB, AC, ......, AZ, BA, BB, BC, etc.).

Global Variables

WinCross provides the functionality to accumulate values between respondents using Global Variables.

 

Global variables can be used wherever WinCross logic is entered.

 

The syntax for defining/using a global variable is:

 

_GLOBAL_xxx (where "xxx" can be alpha and/or numeric characters)

 

For example:

 

_GLOBAL_TEST1

_GLOBAL_HIGHSCHOOL_GRADS

_GLOBAL_99

 

are all examples of the correct syntax for naming a global variable.

 

Random Number Generator

WinCross provides commands to generate random numbers for all or a select group of respondents in your data file.

You can define a variable in the glossary for storing the random number generated for each respondent or you can use the internal variable _RANDOM in WinCross logic.

 

For example, the following commands:

 

DECLARE MY_NUMBER:4

_RANDOM_SEED 1

_RANDOM_HIGH 9999

_RANDOM_LOW 1

ASSIGN MY_NUMBER = _RANDOM

 

will generate a random number from 1 to 9999 and assign the random number into the new variable MY_NUMBER.