You are on page 1of 4

COMPRESSED and UNCOMPRESSED

Subcommands (SAVE command)


COMPRESSED saves the file in compressed form. UNCOMPRESSED saves the
file in uncompressed form. In a compressed file, small integers (from 99 to
155) are stored in one byte instead of the eight bytes that are used in an
uncompressed file.

The only specification is the keyword COMPRESSED or UNCOMPRESSED.

Compressed data files occupy less disk space than uncompressed data
files.

Compressed data files take longer to read than uncompressed data files.

The GET command, which reads PASW Statistics data files, does not need
to specify whether the files that it reads are compressed or uncompressed.

Only one of the subcommands COMPRESSED or UNCOMPRESSED can be


specified per SAVE command. COMPRESSED is usually the default, though
UNCOMPRESSED may be the default on some systems.

Overview (DEFINE-!ENDDEFINE
command)
DEFINE!ENDDEFINE defines a program macro, which can then be used
within a command sequence. A macro can be useful in several different
contexts. For example, it can be used to:

Issue a series of the same or similar commands repeatedly, using looping


constructs rather than redundant specifications.

Specify a set of variables.

Produce output from several program procedures with a single command.

Create complex input programs, procedure specifications, or whole


sessions that can then be executed.

A macro is defined by specifying any part of a valid command and giving it a


macro name. This name is then specified in a macro call within a command
sequence. When the program encounters the macro name, it expands the
macro.

DO REPEAT-END REPEAT command


The DO REPEATEND REPEAT structure repeats the same transformations on
a specified set of variables, reducing the number of commands you must
enter to accomplish a task. This utility does not reduce the number of
commands the program executes, just the number of commands you enter.
To display the expanded set of commands the program generates, specify
PRINT on END REPEAT.

DO REPEAT uses a stand-in variable to represent a replacement list of


variables or values. The stand-in variable is specified as a placeholder on one
or more transformation commands within the structure. When the program
repeats the transformation commands, the stand-in variable is replaced, in
turn, by each variable or value specified on the replacement list.

The following commands can be used within a DO REPEATEND REPEAT


structure:

Data transformations: COMPUTE, RECODE, IF, COUNT, and SELECT IF

Data declarations: VECTOR, STRING, NUMERIC, and LEAVE

Data definition: DATA LIST, MISSING VALUES (but not VARIABLE LABELS or
VALUE LABELS)

Loop structure commands: LOOP, END LOOP, and BREAK

Do-if structure commands: DO IF, ELSE IF, ELSE, and END IF

Print and write commands: PRINT, PRINT EJECT, PRINT SPACE, and WRITE

Format commands: PRINT FORMATS, WRITE FORMATS, and FORMATS

Numeric Variables (RECODE command)


Target variables can be existing or new variables. For existing variables,
cases with values not mentioned in the value specifications are not changed.
For new variables, cases with values not mentioned are assigned the system-
missing value.

New numeric variables have default print and write formats of F8.2 (or the
format specified on SET FORMAT).

Recoding a Single Variable Into a Target Variable

RECODE AGE (MISSING=9) (18 THRU HI=1) (0 THRU 18=0) INTO VOTER.

The recoded AGE values are stored in target variable VOTER, leaving AGE
unchanged.

Value 18 and higher values are changed to value 1. Values between 0 and
18, but not including 18, are recoded to 0. If the specification 0 THRU 18
preceded the specification 18 THRU HI, value 18 would be recoded to 0.

Recording Multiple Variables Into Target Variables

RECODE V1 TO V3 (0=1) (1=0) (2=-1) INTO DEFENSE WELFARE HEALTH.

Values for V1 through V3 are recoded and stored in DEFENSE, WELFARE,


and HEALTH. V1, V2, and V3 are not changed.

NULL Subcommand (VARSTOCASES


command)
The NULL subcommand checks each potential new row for null values. A null
value is a system-missing or blank value. By default, VARSTOCASES does not
add a new row that contains null values for all variables created by MAKE
subcommands. You can change the default null-value treatment with the
NULL subcommand.

DROP Do not include a new row when all MAKE variables are null. A potential
new row with null values for all of the variables created by MAKE
subcommands is excluded from the new data file. This is the default. With
this option, you may want to create a count variable to keep track of new
rows because cases in the original data file are not guaranteed to appear in
the new data file.

KEEP Include a new row when all MAKE variables are null. A potential new
row with null values for all of the variables created by the MAKE
subcommand is included in the new data. With this option, you may not need
a count variable to keep track of cases because each row in the original data
will result in a consistent number of rows in the new data file.

You might also like