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?
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.