BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
zimcom
Pyrite | Level 9

Hi community,

 

I have where x is unique

 

xy
118118apple
118875apple
176663pear
166688pear
716729pear
118066Other
121100Other
122088Other
170822Other
166563Orange
166569Orange
176647Orange
716696Orange
166692Orange
118036Undetermined
119849Undetermined
714821Undetermined
160701Undetermined
710769Undetermined

 

I want 

 

xcountpercent(%)
Orange526.32
Other421.05
Undeterm526.32
apple210.53
pear315.79
Total19100

 

THANK you so much and have a great weekend!!!!

1 ACCEPTED SOLUTION

Accepted Solutions
ed_sas_member
Meteorite | Level 14

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;

 

View solution in original post

5 REPLIES 5
PaigeMiller
Diamond | Level 26

This is a simple PROC FREQ

 

proc freq data=have;
     tables y;
run;
--
Paige Miller
zimcom
Pyrite | Level 9

could you please show me the code of how can I get the have.sas  to want.sas?

 

THANK YOU!!!

Cynthia_sas
Diamond | Level 26

Or a simple PROC TABULATE, to get the TOTAL line:
proc tabulate data=<yourdata>;
  class y;
  table y all='Total',
        n pctn;
run;

Cynthia

zimcom
Pyrite | Level 9

Thank you all @Cynthia_sas @ed_sas_member @PaigeMiller 

 

I really appreciated your help

Have a great weekend!!!

ed_sas_member
Meteorite | Level 14

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;

 

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1581 views
  • 1 like
  • 4 in conversation