DATA Step, Macro, Functions and more

Macro not resolved even adding in the SASAUTOS

Accepted Solution Solved
Reply
Regular Contributor
Posts: 240
Accepted Solution

Macro not resolved even adding in the SASAUTOS

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.


Accepted Solutions
Solution
‎08-03-2016 11:20 PM
Super User
Posts: 3,102

Re: Macro not resolved even adding in the SASAUTOS

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


All Replies
Solution
‎08-03-2016 11:20 PM
Super User
Posts: 3,102

Re: Macro not resolved even adding in the SASAUTOS

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.

Super User
Posts: 9,671

Re: Macro not resolved even adding in the SASAUTOS

It should be LIBNAME not FILENAME, if I was right.
Regular Contributor
Posts: 240

Re: Macro not resolved even adding in the SASAUTOS

It is filename.

Super User
Posts: 9,671

Re: Macro not resolved even adding in the SASAUTOS

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';

PROC Star
Posts: 1,230

Re: Macro not resolved even adding in the SASAUTOS

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.)
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 276 views
  • 2 likes
  • 4 in conversation