BookmarkSubscribeRSS Feed
_LB
Fluorite | Level 6 _LB
Fluorite | Level 6
Hello!
I have a question about the autocall facility for invoking macros and perhaps I lack some basic understanding that needs clarification?

I have a macro called fy that is used for fiscal year calculations. It does work as it is embedded in most of my SAS programs.

I saved it as fy.SAS in a folder 'G:\SASprograms\macros'
In a new program I start with:

filename mymacros 'G:\SASprograms\MACROS';
options sasautos=(sasautos mymacros) mautosource;

%fy

data x;
x="&FYPR";
y="&curmonth";
run;

However I get the error that the apparent invocation of macro fy is not resolved that leads to errors.

My assumption is that I should not have to run the fy program
beforehand or is this wrong? My understanding is that this program would compile the macro only when called in this program but perhaps I am wrong?

My ultimate question, is this possible that I can invoke a macro in a program without having to run the separate program.

Any assistance would be greatly appreciated!
6 REPLIES 6
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Suggest generating additional diagnostics for macro compilation, possibly you have some other error in the macro, preventing its successful compilation?

OPTIONS SOURCE SOURCE2 MACROGEN SYMBOLGEN MLOGIC;


Scott Barry
SBBWorks, Inc.
deleted_user
Not applicable
Hi,

ERROR:apparent invocation of macro fy is not resolved

This means the macro is not compiled so sas is not able to pick the macro definition

Try to include the macro code definition to ur program with the following code

%include 'G:\SASprograms\MACROS\filename with extension';

Include this in ur program

Hope this will help you

regards,
skm
_LB
Fluorite | Level 6 _LB
Fluorite | Level 6
SKM;
Your solution worked like a CHARM! Much Thanks!
Lawrence
Russ_SAS
SAS Employee
If this is not your first attempt then you may need to add MRECALL to your OPTIONS statement. If we try and invoke an Autocall macro and for some reason it failed, we do not look back there again, in the same SAS session, unless MRECALL is turned on.
_LB
Fluorite | Level 6 _LB
Fluorite | Level 6
Russ;
Your solution worked too. Many thanks!
_LB
Fluorite | Level 6 _LB
Fluorite | Level 6
Thanks folks for your help I will try the various solutions and post back.
For some odd reason I don't get the notifications anymore that people responded to the queries. Not sure if others are having the same problem.

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
  • 6 replies
  • 899 views
  • 0 likes
  • 4 in conversation