Hi, I'm doing conditional datasets output within a SAS macro:
I already had work.other dataset.
%macro m(w);
data dat1 dat2;
set other; w = &w.;
if diff le &w. then output dat1;
else output dat2; run;
%mend;
It works when I run without the "%macro"
But, when I call the macro by doing "%m(1);", I got an error saying something wrong with the "set":
Statement is not valid or it is used out of proper order.
Thoughts? Thanks!
As the first line of your program, use
options mprint;
Then run the program again, and see if the LOG is more clear and helps you figure out what you did wrong.
If you can't understand what it is telling you, then please copy the log as text (the code AND the error messages) and — DO NOT SKIP THIS STEP — paste it into the window that appears when you click on the {i} icon.
As the first line of your program, use
options mprint;
Then run the program again, and see if the LOG is more clear and helps you figure out what you did wrong.
If you can't understand what it is telling you, then please copy the log as text (the code AND the error messages) and — DO NOT SKIP THIS STEP — paste it into the window that appears when you click on the {i} icon.
Thanks! I got my problem solved.
... and don't forget to accept an answer as solution in https://communities.sas.com/t5/SAS-Programming/Enumerate-unique-value-by-group/m-p/615834
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.