Hi!
I'm using SAS Studio from SAS University Edition through a VirtualBox and I'm trying to write a macro but it seems that the program doesn't recognize the statement. When I try to execute the code nothing happens, not even an error message. Does anyone know what can I do? Or if there is an option I need to activate to the program recognize the macro?
Thanks!
You need to submit the full macro definition at once and it works fine. Run the following and see what happens.
%macro example_print(dsn=);
proc print data=&dsn(obs=5);
run;
%mend;
%example_print(dsn=sashelp.class);
UCLA introductory tutorial on macro variables and macros
https://stats.idre.ucla.edu/sas/seminars/sas-macros-introduction/
Tutorial on converting a working program to a macro
This method is pretty robust and helps prevent errors and makes it much easier to debug your code. Obviously biased, because I wrote it 🙂 https://github.com/statgeek/SAS-Tutorials/blob/master/Turning%20a%20program%20into%20a%20macro.md
Examples of common macro usage
https://communities.sas.com/t5/SAS-Communities-Library/SAS-9-4-Macro-Language-Reference-Has-a-New-Ap...
Please post the code you run, using the "running man" button (eigth in the row above the posting window).
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.