13.6 TEMPORARY

TEMPORARY.

TEMPORARY is used to make the effects of transformations following its execution temporary. These transformations affect only the execution of the next procedure or procedure-like command. Their effects are not be saved to the active dataset.

The only specification on TEMPORARY is the command name.

TEMPORARY may not appear within a DO IF or LOOP construct. It may appear only once between procedures and procedure-like commands.

Scratch variables cannot be used following TEMPORARY.

13.6.1 Example Temporary

In Example 13.4 there are two COMPUTE transformation. One of them immediatly follows a TEMPORARY command, and therefore has effect only for the next procedure, which in this case is the first DESCRIPTIVES command.

data list notable /x 1-2.
begin data.
 2
 4
10
15
20
24
end data.

compute x=x/2.

temporary.
compute x=x+3.

descriptives x.
descriptives x.

Example 13.4: Running a COMPUTE transformation after TEMPORARY

The data read by the first DESCRIPTIVES procedure are 4, 5, 8, 10.5, 13, 15. The data read by the second DESCRIPTIVES procedure are 1, 2, 5, 7.5, 10, 12. This is because the second COMPUTE transformation has no effect on the second DESCRIPTIVES procedure. You can check these figures in Result 13.2.

Descriptive Statistics
N Mean Std Dev Minimum Maximum
x 6 9.25 4.38 4 15
Valid N (listwise) 6
Missing N (listwise) 0
Descriptive Statistics
N Mean Std Dev Minimum Maximum
x 6 6.25 4.38 1 12
Valid N (listwise) 6
Missing N (listwise) 0

Result 13.2: The results of running two consecutive DESCRIPTIVES commands after a temporary transformation