BookmarkSubscribeRSS Feed
martasofiasousa
Calcite | Level 5

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! 

2 REPLIES 2
Reeza
Super User

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

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 394 views
  • 0 likes
  • 3 in conversation