Folks, I'm following the steps in the above example to attempt to create a macro which will read over various values. However, I'm running into trouble. https://blogs.sas.com/content/sastraining/2015/01/30/sas-authors-tip-getting-the-macro-language-to-perform-a-do-loop-over-a-list-of-values/ So I want my code to read in the following values (1e, 1f etc.) And then spit out 7 new datasets where they would be called test1e , test1f, test1g etc. %macro px;
%let value = 1e 1f 1g 1h 1b 1a 1c;
%local i next_value;
%let i=1;
%do %while (%scan(&value, &i) ne );
%let next_value = %scan(&value, &i);
%let i = %eval(&i + 1);
%end;
data test&value;
set table_&value;run;
%mend;
%px; However, I'm running into the following issues. NOTE: Line generated by the macro variable "VALUE".
44 test1e 1f 1g 1h 1b 1a 1c
_ _ _
22 22 22
200 200 200
_ _ _
22 22 22
200 200 200
SYMBOLGEN: Macro variable VALUE resolves to 1e 1f 1g 1h 1b 1a 1c
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, (, /, ;, _DATA_, _LAST_, _NULL_.
ERROR 200-322: The symbol is not recognized and will be ignored.
NOTE: Line generated by the macro variable "VALUE".
44 table_1e 1f 1g 1h 1b 1a 1c
_ _ _
22 22 22
200 200 200
_ _ _
22 22 22
200 200 200
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, (, -, :, ;, CUROBS, END, INDSNAME, KEY,
KEYRESET, KEYS, NOBS, OPEN, POINT, _DATA_, _LAST_, _NULL_.
ERROR 200-322: The symbol is not recognized and will be ignored. It doesn't seem to be looping over things correctly. Any input would be great
... View more