Dear Everyone,
I wanted to add prefix "o" to all the variables in foo.
But I don't understand what is missing.
Can anyone point me out please?
Thanks in advance.
After the last iteration, this is what SAS log shows.
SYMBOLGEN: Macro variable VAR86 resolves to val86
MLOGIC(ADDPREFIX): %DO loop index variable I is now 87; loop will not iterate again.
NOTE: Line generated by the invoked macro "ADDPREFIX".
10937 quit; run;
-
73
76
The error it gives are
ERROR 73-322: Expecting an =.
ERROR 76-322: Syntax error, statement will be ignored.
%macro addprefix(add=);
proc datasets library=work;
modify foo;
rename %do i=1 %to &num_vars.; &&var&i=&add.&&var&i. %end;
quit;
run;
%mend addprefix;
%addprefix(add=o);
Thanks @gamotte for your quick response.
Why is another ; needed?
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!
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.