Examples (TEMPORARY command)

Basic example

SORT CASES BY SEX.
TEMPORARY.
SPLIT FILE BY SEX.
FREQUENCIES VARS=INCOME /STATISTICS=MEDIAN.
FREQUENCIES VARS=INCOME /STATISTICS=MEDIAN.
  • SPLIT FILE applies to the first FREQUENCIES procedure, which generates separate median income tables for men and women.
  • SPLIT FILE is not in effect for the second FREQUENCIES procedure, which generates a single median income table that includes both men and women.

Temporary transformations for a new variable

DATA LIST FILE=HUBDATA RECORDS=3
  /1 #MOBIRTH #DABIRTH #YRBIRTH 6-11 DEPT88 19.
COMPUTE    AGE=($JDATE - YRMODA(#YRBIRTH,#MOBIRTH,#DABIRTH))/365.25.
VARIABLE LABELS AGE 'EMPLOYEE''S AGE'
           DEPT88 'DEPARTMENT CODE IN 1988'.
 
TEMPORARY.
RECODE AGE (LO THRU 20=1)(20 THRU 25=2)(25 THRU 30=3)(30 THRU 35=4)
       (35 THRU 40=5)(40 THRU 45=6)(45 THRU 50=7)(50 THRU 55=8)
       (55 THRU 60=9)(60 THRU 65=10)(65 THRU HI=11).
VARIABLE LABELS AGE 'EMPLOYEE AGE CATEGORIES'.
VALUE LABELS AGE 1 'Up to 20' 2 '20 to 25' 3 '25 to 30' 4 '30 to 35'
       5 '35 to 40' 6 '40 to 45' 7 '45 to 50' 8 '50 to 55'
       9 '55 to 60' 10 '60 to 65' 11 '65 and older'.
 
FREQUENCIES VARIABLES=AGE.
MEANS AGE BY DEPT88.
  • COMPUTE creates variable AGE from the dates in the data.
  • FREQUENCIES uses the temporary version of variable AGE with temporary variable and value labels.
  • MEANS uses the unrecoded values of AGE and the permanent variable label.

Using XSAVE with TEMPORARY

GET FILE='/data/hub.sav'.
TEMPORARY.
RECODE DEPT85 TO DEPT88 (1,2=1) (3,4=2) (ELSE=9).
VALUE LABELS DEPT85 TO DEPT88 1 'MANAGEMENT' 
                             2 'OPERATIONS' 
                             3 'UNKNOWN'.
XSAVE OUTFILE='/temp/hubtemp.sav'.
CROSSTABS DEPT85 TO DEPT88 BY JOBCAT.
  • Both the saved data file and the CROSSTABS output will reflect the temporary recoding and labeling of the department variables.
  • If XSAVE is replaced with SAVE, the saved data file will reflect the temporary recoding and labeling but the CROSSTABS output will not.