Hello all,
A basic question regarding mrecall of macros-
OK I have a program that calls all these macros-
%monthday
%monthnight
%monthBMT
Within each of the macros I run another macro called %UNITSPEC that essentially does the same thing to each of the programs above but with some minor changes in the underlying query-
However after the first program runs, it crashes out on me-log output follows as below-
I do have within each program above-
filename hhmacros "\\Fpmcb11\InfectionControl\sasprograms\MACROS\HH";
options mrecall mautosource sasautos=(hhmacros sasautos)
to recall the macros each time. Is this necessary?
Thanks again.
Lawrence
ERROR:Windows Error Reporting failed because the client was not found.
ERROR: Read Access Violation In Task [ Submit ]
Exceptionoccurred at (016F9DBA)
TaskTraceback
Address Frame (DBGHELP API Version 4.0 rev 5)
016F9DBA 0852D6FC sashost:Main+0xE37F6
0164D839 0852D970 sashost:Main+0x37275
01655CC8 0852D9C0 sashost:Main+0x3F704
674917BE 0852DA20 sasxzcrp:mcn_main+0x7BE
671F2984 0852DA4C sasxmac:mcn_main+0x1984
023E5B43 0852FB38 sasxshel:mcn_main+0x4B43
023E51BE 0852FB54 sasxshel:mcn_main+0x41BE
02406DE6 0852FB84 sasxshel:mcn_main+0x25DE6
02406C12 0852FB9C sasxshel:mcn_main+0x25C12
02404F81 0852FC28 sasxshel:mcn_main+0x23F81
023F0725 0852FC58 sasxshel:mcn_main+0xF725
023F4250 0852FCA8 sasxshel:mcn_main+0x13250
023FEA6E 0852FCE0 sasxshel:mcn_main+0x1DA6E
023FC92F 0852FD64 sasxshel:mcn_main+0x1B92F
0241CE05 0852FEF8 sasxshel:mcn_main+0x3BE05
02420169 0852FF6C sasxshel:mcn_main+0x3F169
02420C9E 0852FF8C sasxshel:mcn_main+0x3FC9E
01622854 0852FFA0 sashost:Main+0xC290
0170F038 0852FFB4 sashost:Main+0xF8A74
7C80B729 0852FFEC kernel32:GetModuleFileNameA+0x1BA
ERROR: Generic criticalerror
Sorry about the error message that did not print right.
I think you need not to recall macro.
Using options mrecall is because SAS defaultly search macro only once in these libraries( hhmacros sasautos ).
So mrecall can force SAS to search macro many times.
Since you can run your macro at SAS, The error maybe is your macro has some problems.
Ksharp
KSharp;
The macro does work perfectly in all the programs if I run them separately-
The first one works w/o incident, but then when it comes to the second one,
it gives this error-
NOTE: Autocall member, UNITSPEC, has not been compiled by the macro processor. It may contain a macro syntax error
or not define a macro with the same name as the member. To autocall this member again, set OPTION MRECALL.
ERROR: Windows Error Reporting failed because the client was not found.
ERROR: Read Access Violation In Task [ Submit ]
I have option MRECALL set into each macro but perhaps I need to set it differently?
Thanks.
Thanks again.
Lawrence
Sounds more like the macro is not cleaning up. Perhaps it is leaving a file open?
Perhaps if you stick end extra semi-colons after the macro call so that SAS knows that it shouldn't look of parameters.
Also check the macro source code. Does it include anY statements before the %MACRO or after the %MEND ? If so then those statements will only work the first time you compile the macro.
If you want to recompile the macro you can just include it again.
%inc hhmacros(unitspec);
%monthday;
%inc hhmacros(unitspec);
%monthnight;
%inc hhmacros(unitspec);
%monthBMT;
Tom,
That works! Thank you!
Lawrence
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.