BookmarkSubscribeRSS Feed
deleted_user
Not applicable
How to store macro and how to call the macro?
1 REPLY 1
deleted_user
Not applicable
From SAS documentation:

MAUTOSOURCE System Option

--------------------------------------------------------------------------------

Controls whether the autocall feature is available Type: System option
Valid in: Configuration file

OPTIONS window
OPTIONS statement
SAS invocation


Default: MAUTOSOURCE
PROC OPTIONS GROUP= MACRO

MAUTOSOURCE | NOMAUTOSOURCE

MAUTOSOURCE
causes the macro processor to search the autocall libraries for a member with the requested name when a macro name is not found in the WORK library.

===========================================================

SASAUTOS= System Option

--------------------------------------------------------------------------------

Specifies one or more autocall libraries Type: System option
Valid in: Configuration file

OPTIONS window
OPTIONS statement
SAS invocation

PROC OPTIONS GROUP= ENVFILES
MACRO

SASAUTOS= library-specification |
(library-specification-1 . . . , library-specification-n)

Details


When SAS searches for an autocall macro definition, it opens and searches each location in the same order that it is specified in the SASAUTOS option. If SAS cannot open any specified location, it generates a warning message and sets the NOMAUTOSOURCE system option on. To use the autocall facility again in the same SAS session, you must specify the MAUTOSOURCE option again.

===========================================================

We created a directory which we call "MACLIB".
The directory exists in Prod, Test and Dev -- .../Prod/MacLib, .../Test/MacLib, .../Dev/MacLib.
We have a standard library that we define:
Libname maclib (".../&environment/MacLib", ".../Prod/MacLIb") ;
We then define the options:
options MAUTOSOURCE SASAUTOS=(MacLib, SASAUTOS);

"&environment" is set earlier by a macro that recognizes where the source code is being executed from so that it can set the runtime environment: Prod, Test or Dev.
This method allows for change control, and means you don't have to have a complete copy of production in the development and test environments.

Read about concatenated Libraries in the SAS documentation.

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
  • 1 reply
  • 767 views
  • 0 likes
  • 1 in conversation