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
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.