Hello,
I want to compare the running time difference of a large MACRO with several different small macro.
For example. one is %macro A and another is %micro B. what code I should use and where I should input?
%micro A;
%micro bb;
%micro ccc;
%mend ccc;
%mend bb;
%mend A;
%micro B;
%micro bb;
%micro ccc;
%micro dddd;
%mend dddd;
%mend ccc;
%mend bb;
%mend B;
Thanks a lot
https://blogs.sas.com/content/sgf/2015/01/21/sas-timer-the-key-to-writing-efficient-sas-code/
@xiangpang wrote:
Hello,
I want to compare the running time difference of a large MACRO with several different small macro.
For example. one is %macro A and another is %micro B. what code I should use and where I should input?
%micro A; %micro bb; %micro ccc; %mend ccc; %mend bb; %mend A; %micro B; %micro bb; %micro ccc; %micro dddd; %mend dddd; %mend ccc; %mend bb; %mend B;Thanks a lot
https://blogs.sas.com/content/sgf/2015/01/21/sas-timer-the-key-to-writing-efficient-sas-code/
@xiangpang wrote:
Hello,
I want to compare the running time difference of a large MACRO with several different small macro.
For example. one is %macro A and another is %micro B. what code I should use and where I should input?
%micro A; %micro bb; %micro ccc; %mend ccc; %mend bb; %mend A; %micro B; %micro bb; %micro ccc; %micro dddd; %mend dddd; %mend ccc; %mend bb; %mend B;Thanks a lot
Thank you very much.
I think you got an answer to your question but the code you posted is very puzzling. It seems to show marco DEFINITIONS nested inside of each other.
You should NEVER do that.
You can call another macro inside of a macro, so that when it runs they are nested. But the store of compiled macros is a flat directory. At any point in time you can only have one macro named CCC. You cannot have one defined inside of A and a different one that is defined only when B is running. If you compile a new definition of CCC it overwrites the previous definition of CCC.
%macro A;
%put Inside A;
%bb;
%put Back to A;
%mend A;
%macro bb;
%put Inside BB;
%ccc;
%put Back to BB;
%mend bb;
%macro ccc;
%put Inside CCC ;
%mend ccc;
317 %A; Inside A Inside BB Inside CCC MPRINT(BB): ; Back to BB MPRINT(A): ; Back to A
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.