BookmarkSubscribeRSS Feed
buddha_d
Pyrite | Level 9

Can someone help me how to learn about macros for SAS from scratch? How to get started and used. 

Would you recommend any paper or material that would be great. 

The next question would be 

How we can store in the library and use it when it needed? 

 

2 REPLIES 2
ballardw
Super User

First would be to become fairly familiar with basic SAS programming language, such a completion of the Programming 1 course before getting involved with macros at all. Macros only generate SAS code, so knowing what code to generate is key.

 

Easier than storing compiled macros may be to use the Autocall facility which would point to the location of code files with macros. Compiled macros are stored in catalogs and not very transferable between operating systems (or versions of SAS sometimes).

Autocall involves setting one value and possibly adding your custom location to the search path.

 

For instance in my autoexec sas file I have:

options

insert=(SASAUTOS=("D:\Data"))

;

which tells SAS to look for my custom macros at D:\Data and compiles them as needed. Insert is so that location is added to the list of locations that SAS already maintains internally for its own macros.

Reeza
Super User

There's a specific SAS course, Programming 3 I believe that covers this. 

 

If you're not interested in the official courses there are tons of user papers/tutorials here:

http://lexjansen.com/search/searchresults.php?q=introduction%20to%20macros

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

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
  • 663 views
  • 0 likes
  • 3 in conversation