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

Greeting community !!

 

I need to calculating the percentage with different denominator.

for variable A% - G%, the denominator is variable "All", so the computation is straight forwards.

But hwo should I calculate variable All%, which use the Total (sum of variable "All"). 

 

I hope I am clear. Can someone point me a direction.... Thanks !!!

 AllABCDEFGAll%A%B%C%D%E%F%G%
Z35669361969155989356/100269/35636/35619/35669/35615/35659/35689/356
Y3713279087294779371/1002       
X2754649313594146275/1002       
Total1002##158333966093        
1 ACCEPTED SOLUTION

Accepted Solutions
ed_sas_member
Meteorite | Level 14

Hi @zimcom 

 

You can also simply use a proc freq. It depends whether you want to stick to the format of the output.

proc freq;
	table y*x;
run;

View solution in original post

2 REPLIES 2
Patrick
Opal | Level 21

One of the below two links might give you an idea:

https://support.sas.com/resources/papers/proceedings13/134-2013.pdf 

https://communities.sas.com/t5/SAS-Programming/PROC-Tabulate-displaying-counts-and-percentages-with-... 

 

data have;
  input y $ x $;
  datalines;
X A
X A
X B
Y A
Y B
Y B
Y B
;

proc tabulate data=have noseps;
  class y x;
  table
    y all,
    (all x) (all x)*colpctn
  ;
run;

Capture.JPG

 

ed_sas_member
Meteorite | Level 14

Hi @zimcom 

 

You can also simply use a proc freq. It depends whether you want to stick to the format of the output.

proc freq;
	table y*x;
run;

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 2 replies
  • 926 views
  • 1 like
  • 3 in conversation