DATA Step, Macro, Functions and more

autocall facility vs stored macro & how do I properly invoke them?

Reply
Regular Contributor
Regular Contributor
Posts: 170

autocall facility vs stored macro & how do I properly invoke them?

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!
Super Contributor
Super Contributor
Posts: 3,174

Re: autocall facility vs stored macro & how do I properly invoke them?

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.
N/A
Posts: 0

Re: autocall facility vs stored macro & how do I properly invoke them?

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
Regular Contributor
Regular Contributor
Posts: 170

Re: autocall facility vs stored macro & how do I properly invoke them?

Posted in reply to deleted_user
SKM;
Your solution worked like a CHARM! Much Thanks!
Lawrence
SAS Employee
Posts: 9

Re: autocall facility vs stored macro & how do I properly invoke them?

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.
Regular Contributor
Regular Contributor
Posts: 170

Re: autocall facility vs stored macro & how do I properly invoke them?

Russ;
Your solution worked too. Many thanks!
Regular Contributor
Regular Contributor
Posts: 170

Re: autocall facility vs stored macro & how do I properly invoke them?

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.
Ask a Question
Discussion stats
  • 6 replies
  • 206 views
  • 0 likes
  • 4 in conversation