Overview (TEMPORARY command)

TEMPORARY signals the beginning of temporary transformations that are in effect only for the next procedure. With the exception of variables created or modified by the next procedure (for example, residual values saved as variables by REGRESSION), numeric or string variables created while the TEMPORARY command is in effect are temporary variables, and any modifications made to existing variables while the TEMPORARY command is in effect are also temporary. Any variables created or modified by the next procedure are permanent.

With TEMPORARY, you can perform separate analyses for subgroups in the data and then repeat the analysis for the file as a whole. You can also use TEMPORARY to transform data for one analysis but not for other subsequent analyses.

TEMPORARY can be applied to the following commands:

  • Transformation commands COMPUTE, RECODE, IF, and COUNT, and the DO REPEAT utility.
  • The LOOP and DO IF structures.
  • Format commands PRINT FORMATS, WRITE FORMATS, and FORMATS.
  • Data selection commands SELECT IF, SAMPLE, FILTER, and WEIGHT.
  • Variable declarations NUMERIC, STRING, and VECTOR.
  • Labeling commands VARIABLE LABELS and VALUE LABELS, and the MISSING VALUES command.
  • SPLIT FILE.
  • PRINT, WRITE, XSAVE.

Basic specification

The only specification is the keyword TEMPORARY. There are no additional specifications.

Operations

  • Once TEMPORARY is specified, you cannot refer to previously existing scratch variables.
  • Temporary transformations apply to the next command that reads the data. Once the data are read, the temporary transformations are no longer in effect.
  • The XSAVE command leaves temporary transformations in effect. SAVE, however, reads the data and turns temporary transformations off after the file is written. (See Examples.)
  • TEMPORARY cannot be used with SORT CASES, MATCH FILES, ADD FILES, or COMPUTE with a LAG function. If any of these commands follows TEMPORARY in the command sequence, there must be an intervening procedure or command that reads the data to first execute the TEMPORARY command.
  • TEMPORARY cannot be used within the DO IF—END IF or LOOP—END LOOP structures.

If any variables have an unknown measurement level, the measurement level for those variables remains unknown after a procedure that follows a TEMPORARY command. (In the absence of the TEMPORARY command, the data pass performed by the procedure would assign default measurement levels to all variables with an unknown measurement level.)