BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
RahulG
Barite | Level 11

I am running on SAS 9.4 environment.

 

In my macro folder "c:\macro",  I have two files a.sas and b.sas. a.sas contains %a definition and similary b.sas contain %b definition

 

%a;

filename mac_ref "c:\macro";
options APPEND = SASAUTOS=(,mac_ref);

%b;

%a;

call of %b is successfull and call %a throws error "Apparent symbol not resolved".

 

Problem that I am facing is  If I call any macro before Options append then it do not resolve at all in the session, even after reference appended in SASAUTOS.

1 ACCEPTED SOLUTION

Accepted Solutions
SASKiwi
PROC Star

What you are seeing is standard SAS behaviour. When you first call %A it will not be found as SASAUTOS follows. SAS defines a dummy macro called A since it cant find the real A. This then blocks you from finding the real A after your SASAUTOS statement.

 

A good practice is to put your SASAUTOS statement into your AUTOEXEC.SAS program so it will be run each time you start SAS. That way even a macro call as your first program statement will always work.

View solution in original post

5 REPLIES 5
SASKiwi
PROC Star

What you are seeing is standard SAS behaviour. When you first call %A it will not be found as SASAUTOS follows. SAS defines a dummy macro called A since it cant find the real A. This then blocks you from finding the real A after your SASAUTOS statement.

 

A good practice is to put your SASAUTOS statement into your AUTOEXEC.SAS program so it will be run each time you start SAS. That way even a macro call as your first program statement will always work.

Ksharp
Super User
It should be LIBNAME not FILENAME, if I was right.
RahulG
Barite | Level 11

It is filename.

Ksharp
Super User
That is a SAS program file , Not compiled macro of SAS .
You can't use it in this way. Should be :

%include 'c:\temp\a.sas';

%include 'c:\temp\b.sas';

Quentin
Super User
Set the system option mrecall. That tells SAS to search the autocall library every time it sees a macro reference, even if it has previously searched and not found it. (The docs says this is inefficient and should only be used in development.)
BASUG is hosting free webinars Next up: Jane Eslinger presenting PROC REPORT and the ODS EXCEL destination on Mar 27 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 5 replies
  • 3238 views
  • 2 likes
  • 4 in conversation