Hi all SAS Users,
Today I want to have the output that Percent is ranked descending.
My code is
ods noproctitle;
title' Categories of Reported Species ';
proc freq data=pg1.np_species;
tables Category/ nocum;
From what I learnt, if I want to have Frequency as descending, I can use option order=freq on proc freq data statement, if I want the order of Category as alphabet ascending, I just add nothing. But when I tried to rank the percent by descending, I cannot do that. I am wondering is there any option to do have the result that Percent will be ranked as descending without creating another proc sort datastep?
Thanks in advance.
P/S: What I tried are:
34 ods noproctitle;
35 title' Categories of Reported Species ';
36 proc freq data=pg1.np_species order=percent;
_______
22
76
ERROR 22-322: Syntax error, expecting one of the following: DATA, FORMATTED, FREQ, INTERNAL.
ERROR 76-322: Syntax error, statement will be ignored.
34 ods noproctitle;
35 title' Categories of Reported Species ';
36 proc freq data=pg1.np_species;
37 tables descending Category/ nocum;
ERROR: Variable DESCENDING not found.
And could you please let me know why these two approaches are wrong?
According to the documentation, you would use:
proc freq data=pg1.np_species order=freq;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.