我正在努力的是采用来自http://www.spsstools.net/的语法/宏之一。
它旨在更改没有前导零的“多对多”变量的标签,但我的变量确实有:
DATA LIST LIST /id.
BEGIN DATA
1
END DATA.
NUMERIC set01sub1 TO set01sub4.
* but the intended variable names are set01sub01 TO set01sub04 (with leading zeros and going over 10).
SET MPRINT=yes.
DEFINE !label (lab=!TOKENS(1) /stem=!TOKENS(1) /nb1=!TOKENS(1) /nb2=!TOKENS(1))
!DO !cnt=!nb1 !TO !nb2
!LET !var=!CONCAT(!stem,!cnt)
!LET !labe=!QUOTE(!CONCAT(!UNQUOTE(!lab),!cnt))
VARIABLE LABEL !var !labe.
!DOEND.
!ENDDEFINE.
!label lab='Set 1, subset ' stem=set01sub nb1=1 nb2=4.
我很天真,我尝试过使用!STRING(...,N2)
:
!LET !labe=!QUOTE(!CONCAT(!UNQUOTE(!lab),!STRING(!cnt,N2)))
但是,这并没有按预期工作
我的变量是
subID
rvnAns_s01m01 TO rvnAns_s01m12
rvnAns_s02m01 TO rvnAns_s02m36
rvnAns_s03m01 TO rvnAns_s03m36
rvnEva_s01m01 TO rvnEva_s01m12
rvnEva_s02m01 TO rvnEva_s02m36
rvnEva_s03m01 TO rvnEva_s03m36
并且预期的标签是:
"Subject ID"
"RAPM, Series 01, Matrix 01 answer"
"RAPM, Series 01, Matrix 02 answer"
...
"RAPM, Series 01, Matrix 12 answer"
"RAPM, Series 02, Matrix 01 answer"
"RAPM, Series 02, Matrix 02 answer"
...
"RAPM, Series 02, Matrix 36 answer"
"RAPM, Series 03, Matrix 01 answer"
"RAPM, Series 03, Matrix 02 answer"
...
"RAPM, Series 03, Matrix 36 answer"
和
"RAPM, Series 01, Matrix 01 answer evaluation"
"RAPM, Series 01, Matrix 02 answer evaluation"
...
"RAPM, Series 01, Matrix 12 answer evaluation"
"RAPM, Series 02, Matrix 01 answer evaluation"
"RAPM, Series 02, Matrix 02 answer evaluation"
...
"RAPM, Series 02, Matrix 36 answer evaluation"
"RAPM, Series 03, Matrix 01 answer evaluation"
"RAPM, Series 03, Matrix 02 answer evaluation"
...
"RAPMs, Series 03, Matrix 36 answer evaluation"
对于如何实现这样的结果,我将非常感谢任何帮助或建议。