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
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.