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
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.