Hi all SAS Users,
I want to ask your experience about how to set the title quickly for the output of a proc mean. Because sometimes I run a lot of proc means and I need to know the name of the dataset it is about.
So, normally, I use the title statement:
proc means data=have;
title "have";
run;
Could you please let me know if there is any way to set the title for the output of proc means without typing the statement title and else?
Warm regards.
@Phil_NZ - You could enhance the macro to do different statistics by adding a stats parameter.
%macro Means (dataset =
,stats_list = );
proc means data= &dataset &stats_list;
title "&dataset";
run;
%mend Means;
%Means (dataset = Have
,stats_list = mean min max);
%Means (dataset = Have2
,stats_list = n min max);
%macro Means (dataset = );
proc means data= &dataset;
title "&dataset";
run;
%mend Means;
%Means (dataset = Have);
Hi @SASKiwi
Thank you very much for the macro, but there would be some proc means I used different options (in one PROC MEAN I may use mean, max, nmiss, n, in another PROC MEAN I may use kurt std max min, and in some PROC MEAN, I may just need one or two specific variables)
So the macro cannot work in these case. But it is a very nice macro. I may adjust all the proc mean together to run the macro if there is no other solution.
Many thanks and warm regards.
@Phil_NZ - You could enhance the macro to do different statistics by adding a stats parameter.
%macro Means (dataset =
,stats_list = );
proc means data= &dataset &stats_list;
title "&dataset";
run;
%mend Means;
%Means (dataset = Have
,stats_list = mean min max);
%Means (dataset = Have2
,stats_list = n min max);
Hi @SASKiwi
Thank you for your insightful suggestion!
Warmest regards
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.