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.
OK 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.