Hi community,
I have where x is unique
x | y |
118118 | apple |
118875 | apple |
176663 | pear |
166688 | pear |
716729 | pear |
118066 | Other |
121100 | Other |
122088 | Other |
170822 | Other |
166563 | Orange |
166569 | Orange |
176647 | Orange |
716696 | Orange |
166692 | Orange |
118036 | Undetermined |
119849 | Undetermined |
714821 | Undetermined |
160701 | Undetermined |
710769 | Undetermined |
I want
x | count | percent(%) |
Orange | 5 | 26.32 |
Other | 4 | 21.05 |
Undeterm | 5 | 26.32 |
apple | 2 | 10.53 |
pear | 3 | 15.79 |
Total | 19 | 100 |
THANK you so much and have a great weekend!!!!
Hi @zimcom
You can add the option OUT= in the PROC FREQ to output a dataset:
proc freq data=have;
table y / out=want;
run;
This is a simple PROC FREQ
proc freq data=have;
tables y;
run;
could you please show me the code of how can I get the have.sas to want.sas?
THANK YOU!!!
Or a simple PROC TABULATE, to get the TOTAL line:
proc tabulate data=<yourdata>;
class y;
table y all='Total',
n pctn;
run;
Cynthia
Thank you all @Cynthia_sas @ed_sas_member @PaigeMiller
I really appreciated your help
Have a great weekend!!!
Hi @zimcom
You can add the option OUT= in the PROC FREQ to output a dataset:
proc freq data=have;
table y / out=want;
run;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.