This is for macro automation purposes, I want to use my first variable x, to create a macro for the 2nd variable var2 which I already have code for
data _null;
set boundvec;
call symputx(x,var2,'G');
run;
but of course I get an error because x is a number; how can I simply add underscores infront of my x variables?
obs x var2
1 | 1 | 521.25175485 |
---|---|---|
2 | 2 | 855.9807884 |
3 | 3 | 1422.6889005 |
4 | 4 | 1929.7196005 |
5 | 5 | 2456.6264165 |
6 | 6 | 3641.1847645 |
7 | 7 | 4406.201729 |
Is this what you are looking for?:
call symputx( cats("_",x),var2,'G');
Hope this helps!
EJ
Is this what you are looking for?:
call symputx( cats("_",x),var2,'G');
Hope this helps!
EJ
Exactly
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.