Dear All,
I have the following macro which gives me error. I want to create as much new variables as many codes I have in v1 to v9, and name the new variables according to these codes. For example if I have codes 1,2,3,4,5, 66,77,99 in v1 to v9, than I want to create vnew_1, vnew_2, vnew_3, vnew_4, vnew_5, vnew_66, vnew_77, vnew_99 with values 1.
DEFINE OES (vars !ENCLOSE('(',')')
/varname !TOKENS (1)).
compute #nr=!vars(all).
vector v=!vars.
compute #i=1.
loop.
do if not missing (v(#i)).
!let !a=v(#i).
!let !n=!CONCAT(!varname,"_",!a).
compute !n=1.
compute #i=#i+1.
end
if.
end loop if #i>#nr.
!ENDDEFINE.
OES vars (v1 to v9) varname=vnew.
Any suggestion is highly appreciated.
Thanks,
Beata