Hello Guys,
I would like to sort my table based on frequency od values. This is my table and code
Data df; Input Players $ Clubs 9-25$; datalines; Ronaldo ManUnited Ronaldo ManUnited Ronaldo RealMadrid Suarez Liverpool
Suarez Liverpool ; run; proc freq data=df; table Players*Clubs / out=counts; run; proc sort data=counts; by players descending Count; run;
I have tried this code but no result. Below is my desired output.
Players Clubs Ronaldo ManUnited Suarez Liverpool
Thanks.
My mistake. I have edited the code. RealMadrid should not appear but I only want rows with 2 or more frequent outcome like Liverpool to appear on the table.
The code you show will not generate the output. Your data step will create the Clubs with only 8 characters, so the result will be "ManUnite".
And correcting that the result will have 3 records.
Players Clubs COUNT PERCENT Ronaldo ManUnited 2 50 Ronaldo RealMadrid 1 25 Suarez Liverpool 1 25
So you have likely done more than you are showing in the code.
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.