Examples (XSAVE command)

Using XSAVE to Consolidate Two Data Passes Into One

GET FILE='/data/hubempl.sav'.
XSAVE OUTFILE='/data/empl88.sav' 
  /RENAME=(AGE=AGE88) (JOBCAT=JOBCAT88).
MEANS RAISE88 BY DEPT88.
  • The GET command retrieves the IBM® SPSS® Statistics data file hubempl.sav.
  • The RENAME subcommand renames variable AGE to AGE88 and variable JOBCAT to JOBCAT88.
  • XSAVE is not executed until the program reads the data for procedure MEANS. The program saves file empl88.sav and generates a MEANS table in a single data pass.
  • After MEANS is executed, the hubempl.sav file is still the active dataset. Variables AGE and JOBCAT retain their original names in the active dataset.

Using Temporary Transformations With XSAVE

GET FILE=hubempl.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='/data/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 SAVE were specified instead of XSAVE, the data would be read twice instead of once and the CROSSTABS output would not reflect the recoding.