admin管理员组文章数量:1410730
been programming in SAS for 14 year and just jumped into SPSS.
In SAS you can combine a macro call and a text string very easily using a period.
i.e.
%let name = ted ;
data work1 ;
var = &name._is_fun ;
run ;
var would resolve to ted_is_fun
I cannot for the life of me figure out how to do this simply in SPSS.
Thanks for the help, My First post!
Mark
been programming in SAS for 14 year and just jumped into SPSS.
In SAS you can combine a macro call and a text string very easily using a period.
i.e.
%let name = ted ;
data work1 ;
var = &name._is_fun ;
run ;
var would resolve to ted_is_fun
I cannot for the life of me figure out how to do this simply in SPSS.
Thanks for the help, My First post!
Mark
Share Improve this question asked Mar 21 at 22:16 Mark HedmanMark Hedman 252 bronze badges 2- Does the SPSS documentation Concatenate (General Concept) help? – Andrew Morton Commented Mar 21 at 22:22
- stackoverflow/questions/43509275/… – Tom Commented Mar 22 at 16:15
1 Answer
Reset to default 0Here's a way to do this type of thing with SPSS macro (look up define - !enddefine
in the documentation):
define !name(!pos=!tokens(1)) !concat("ted",!1) !enddefine.
This is a definition of a macro called !name
which accepts one token after the macro call and concatenates it to the word "ted".
Now you're all set, you can call the macro this way for example:
frequencies !name _is_fun .
(this will be interpreted as frequencies ted_is_fun
.
本文标签: creating a variableSPSS Macros vs SASStack Overflow
版权声明:本文标题:creating a variable, SPSS Macros vs SAS - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744331788a2601000.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论