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
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.