I have created a macro called: num_obs that returns the number of observations in a data set.
I can save the result in an data step like:
data saved_num_obs; observ = %num_obs(WORK.TEST); run;
Now, I would like to save the result to a macro variable instead.
So, how would i save an result from using a macro to a Macro variable?
I thought something like:
%let My_Macro = num_obs(test_table) ;
This does not work.
Any suggestions?
If depends a lot on how the macro works.
But first make sure to actually call the macro and not just assign the name of the macro to the macro variable. You left the % out of your macro call.
%let My_Macro = %num_obs(test_table) ;
Just call the macro the same way you use in the data step: with leading %.
If depends a lot on how the macro works.
But first make sure to actually call the macro and not just assign the name of the macro to the macro variable. You left the % out of your macro call.
%let My_Macro = %num_obs(test_table) ;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.