Hello,
I coded a macro which I then invoked in a second macro like this:
%macro evtstudy(industry,start,end,number);
/*....*/
%mend evtstudy;
/*Evoke event study macro for different industries and event windows*/
%macro evtrun (industry);
%evtstudy (&industry.,-2,3,1);
%mend evtrun;
%evtrun(aerodef);
run;
Before I changed it into a macro everything worked fine but now I always get the error
485: ROW and COLUMN could not be determined.
NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where the error has occurred.
I wonder if it is because how I invoked the macro inside the other macro?
Invoking a macro within another macro is fine, and often a good idea. That sort of message is hard to debug, but the problem should be somewhere within your code (could be missing semicolon sometimes?).
Below example code runs fine:
%macro evtstudy(industry,start,end,number);
%put macro EVTSTUDY running &=industry &=start &=end &=number ;
%mend evtstudy;
%macro evtrun (industry);
%put macro EVTRUN running &=industry ;
%evtstudy (&industry.,-2,3,1);
%mend evtrun;
%evtrun(aerodef)
Logs is:
34 %evtrun(aerodef) macro EVTRUN running INDUSTRY=aerodef macro EVTSTUDY running INDUSTRY=aerodef START=-2 END=3 NUMBER=1
Calling a macro from another macro is not a problem. I do it all the time. You must be doing something else wrong.
OPTIONS MPRINT;
and lots of other debugging options can help you debug.
Try running again after turning on SPOOL option
OPTIONS SPOOL;
I reckon it might be the use of comment strings like /*----*/ in the macro causing issues. Change to the macro comment style: %*------;
Actually, /* */ comments are fine in a macro. I use them all the time.
Hey everybody, thank you for your answers!
It was actually a way simpler problem. Im invoking this macro for about 100 data sets, but had forgotten one of them in the import macro.. obviously SAS can't compute anything then.. I didn't see this before because SAS Studio didn't show the whole log.
Sorry, Im still a beginner.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.