Define variable1 [###,___,<Y> <DD/MM/YYYY > (or any other date format)][cumulative|Global]
The DEFINE command allows creation of new variables for use in ANALYSIS. The variable type
and length are given, as they are in questionnaires, by underline characters, number symbols, or the European date formats.
The length of the underline or number fields can vary as it does for questionnaires. If no decimal point is specified for
a numeric field, the results will be rounded off to the nearest whole integer. The WIDTH of fields containing decimals
should allow for the decimal point as one character.
Variable names in the define statement must be 10 or fewer characters. National alphabet characters not in the a...z range should be avoided - or testet
for appropriateness.
Variable names may not begin with a number or contain space, hyphens or other punctuation, and cannot start with a number.
Numeric variables are float if no decimal is specified; otherwise they are real or "floating point" numbers.
Defined variables begin with values set to missing.
There are three types of defined variables--standard, CUMULATIVE, and GLOBAL. The difference is in the time when the
variable is reset to the missing value.
Standard variables are reset after each record is processed in a procedure such as FREQ, LIST, or TABLES. They are
useful for calculations that are to be performed within each record.
CUMULATIVE variables are reset to the missing whenever a new command that causes the file to be READ
is given. They are useful for maintaining sums or other values that are cumulative from record to record but that should
begin again when a FREQ, LIST, or TABLE is done.
Both standard and CUMULATIVE defined variables are reset by the READ statement and are therefore not useful for
maintaining values that will be used during a series of programs with different data files.
GLOBAL variables are provided for this purpose. They are not reset by the READ statement, and only a QUIT or an explicit
assignment will reset their value. If the user enters the week of processing desired, this might be kept in a GLOBAL
variable throughout a complex series of programs so that the user doesn't have to be asked again to enter the week number.
Output:
Examples and Hints
DEFINE RACENAME __________ (Could be used in a RECODE statement to provide labels for a numerically coded RACE variable)
DEFINE COUNTYCODE ###
DEFINE TOTALCOST #####.## CUMULATIVE (Could be used to maintain a running total by adding cost in each record to TOTALCOST.)
DEFINE FOLLOWUP <dd/mm/yyyy > (European date)
DEFINE FOLLOWUP <dd/mm/yyyy > GLOBAL (European date, global variable)
DEFINE CASE <Y>
Notice:
Related Commands:
Gen
Options:
No Options for this command
|
|
Output variables:
No output variables for this command
|
|
Output definition:
References:
Top