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) ;
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!
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.