1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
* Assign variable and value labels of a given variable to other vars.
* This is VERY useful.
* Raynald Levesque March 2001.

SET MPRINT=yes.

* Apply variable label and value labels of VAR1 to VARLIST.
*/////////////////////////////////.
DEFINE !applab (!POS=!TOKENS(1) /tovars=!CMDEND)
* Apply variable and value labels of VAR1 to VARLIST.
* rlevesque@videotron.ca.

RENAME VARIABLES (!1=model).
!LET !filenam=!QUOTE(!CONCAT('c:\\temp\\dictionary',!1,'.sav'))
SAVE OUTFILE=!filenam /KEEP=model.
RENAME VARIABLES (model=!1).
!DO !var !IN (!tovars)
RENAME VARIABLES (!var=model).
APPLY DICTIONARY FROM !filenam.
RENAME VARIABLES (model=!var).
!DOEND
!ENDDEFINE.
*/////////////////////////////////.

 
GET FILE='c:\\program files\\spss\\employee data.sav'.

COMPUTE jobcat1=jobcat.
COMPUTE test=jobcat.
COMPUTE test2=jobcat.

* Following macro call applies variable and value labels of jobcat TO jobcat1 test and test2.
!applab jobcat tovars=jobcat1 test test2.
EXECUTE.