I'm trying to build a simple variable in spss like below but can't figure it out from documentation. In sas, you simply need to put qoutes around your macro to resolve. Can't figure out how in SPSS.
define !reg (name= !tokens(1)).
compute !concat(!name,'_f') = 0.
if type =("!name") compute !concat(!name,'_f') = 1.
execute.
!enddefine.
!reg name=joe.
I'm trying to build a simple variable in spss like below but can't figure it out from documentation. In sas, you simply need to put qoutes around your macro to resolve. Can't figure out how in SPSS.
define !reg (name= !tokens(1)).
compute !concat(!name,'_f') = 0.
if type =("!name") compute !concat(!name,'_f') = 1.
execute.
!enddefine.
!reg name=joe.
Share
Improve this question
asked Mar 25 at 19:51
Mark HedmanMark Hedman
232 bronze badges
1 Answer
Reset to default 0OK so you want the value of !name
to be in quotes in the resulting syntax, but putting the quotes there in type =("!name")
disrupts the macro. So the solution is
!quote(!name)
Now I'm not sure what you are doing with the macro here, but I suggest a couple of corrections to the full line of code - no need for parentheses around the quote, no need for compute
after the if
:
if type = !quote(!name) !concat(!name,'_f') = 1.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744172262a4561590.html
评论列表(0条)