I was wondering if there was a way to change the order in the variable analysis. Proc means automatically displays the variable analysis in alphabetical order, but is it possible to display the variable from highest to lowest mean or to only display the highest mean.
thanks
Use the OUTPUT option of PROC MEANS to get the results in a sas dataset,
then use PROC PRINT or PROC REPORT to get the report with any desired order of variables.
proc means has a STACKODSOUTPUT, that works in combination with the ODS OUTPUT statement. The output statement would ordinarily generate extra columns in the output dataset when you add vars to be analyzed. But you actually want rows added for each analysis variable. That what the STACKODSOUTPUT paramenter does:
ods listing close;
proc means data=sashelp.class stackodsoutput;
var height weight;
ods output summary=mydata;
run;
ods listing;
proc sort data=mydata;
by descending mean;
run;
proc print data=mydata;run;
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: