Hi all,
Have a 4 column data as below:
And code as below:
title1 'WORK.BINORI 的清單資料'; proc sort data=WORK.BINORI out=WORK.SORTTEMP; by IBVEND; run; proc print data=WORK.SORTTEMP label; by IBVEND; sum COUNT; id NORI; run;
And result as below:
NORI is binary as null or the 3 Chinese characters.
However try to print data in the order by sum of Count, not by sorted variable "IBVEND", appreciate any comment.
Here is an example of @andreas_lds suggestion with a data set you should have available to test the code with.
Proc summary data=sashelp.class nway; class age; var height; output out=agesummary (drop= _type_ _freq_) sum=; run; proc sort data=agesummary; by descending height; run; proc print data=agesummary noobs; var age height; run;
You could have more variables on the CLASS statement if needed for the groups, more than one output variable created and multiple statistics from the Proc Summary output. Then sort that resulting data set as desired.
Using BY in proc sort will always result in output being sorted by the variable(s) listed in the the statement. Instead of using proc sort + proc print, you could use proc summary + sort + print to get what you want.
Here is an example of @andreas_lds suggestion with a data set you should have available to test the code with.
Proc summary data=sashelp.class nway; class age; var height; output out=agesummary (drop= _type_ _freq_) sum=; run; proc sort data=agesummary; by descending height; run; proc print data=agesummary noobs; var age height; run;
You could have more variables on the CLASS statement if needed for the groups, more than one output variable created and multiple statistics from the Proc Summary output. Then sort that resulting data set as desired.
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!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.