DATA Step, Macro, Functions and more

how to delete an autocall location from SASAUTOS?

Frequent Contributor
Posts: 91

how to delete an autocall location from SASAUTOS?

SAS folks-

Recently, I added a directory for general-purpose macros to SASAUTOS in my autoexec file by using the append method from this helpful SAS sample.

FILENAME U_MACROS "&utility\utility_macros" ;

options append=sasautos=(U_MACROS);


%put %sysfunc(getoption(sasautos));

gives me back


I also have macros that are applied in different situations - one being a series of programs that extract data from our databases in Oracle. To add that directory, I was thinking of adding

FILENAME DB_MACS "&utility\database_utility_macros" ;

options append=sasautos=(DB_MACS);

to give


at the beginning of the code that runs those programs.  However, when the database series of programs is over, the DB_MACS macros no longer apply, and I would need to set SASAUTOS back to (SASAUTOS U_MACROS), before going on to the rest of the program run.  I've been looking through the documentation, but can't seem to find an option to delete from SASAUTOS.

Your help would be greatly appreciated!

Wendy T.

Super User
Super User
Posts: 8,125

Re: how to delete an autocall location from SASAUTOS?

The easiest solution is to remember the setting before you changed it and then restore it when it no longer applies.

%let save=%sysfunc(getoption(sasautos));


options sasautos=&save ;

If that is impossible then you can use some logic to find and remove a particular value.  But remember that the value could include actual path names in addition to filerefs.


%put %sysfunc(getoption(sasautos));

data _null_;

  sasautos = getoption('sasautos');

  i = findw(sasautos,"&remove",'( )','mqri');

  if i then sasautos = substr(sasautos,1,i-1)

                    || substr(sasautos,i+length("&remove"))


  call execute(catx(' ','options sasautos=',sasautos,';'));


%put %sysfunc(getoption(sasautos));

Super User
Posts: 3,926

Re: how to delete an autocall location from SASAUTOS?

Well one way would be: options sasautos = (SASAUTOS, UMACROS); Even if the DB_MACS no longer apply there would be no harm leaving them in the AUTOCALL definition even if you are not using them.

Frequent Contributor
Posts: 91

Re: how to delete an autocall location from SASAUTOS?

Tom & SASKiwi-

Thanks so much for your replies!  I was thinking that I just couldn't find an option that exists.  I also thought about using FILENAME DB_MACS CLEAR;  I'll have to do some experimentation next week, as this affects my main product runs, and I will have to set up an analog for testing.

SASKiwi-  Actually, I can't leave DB_MACS active, as some of the macros have the same names and functions, but use different variable names.  I know that's bad form, but I wrote the original macros for my project (in SAS datasets with 'my' variable names), then later generalized them to our Oracle databases, so they can be used for any project.  When I'm doing things in Oracle, I have to use nasty variable names like WTR_QUAL_PARAM_NM instead of ANALYTE and MTHD_DTCTN_LMT_VAL instead of MDL, and so forth.

Thanks for your help!


Super User
Posts: 3,926

Re: how to delete an autocall location from SASAUTOS?

In that case just thought it is useful to point out that the search order for AUTOCALL macros is from left to right so if you want your DB_MACS versions to be used in preference to the UMACROS versions then you could specify it like this:

options sasautos = (DB_MACS, UMACROS, SASAUTOS); This has the same effect as the APPEND feature.

Valued Guide
Posts: 2,191

Re: how to delete an autocall location from SASAUTOS?

The INSERT option is similar to APPEND but has the effect of giving priority to the folder of macros that you "insert" , as the folder is INSERTed at the beginning of the SASAUTOS vslue.


Ask a Question
Discussion stats
  • 5 replies
  • 4 in conversation