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;

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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
  • 1098 views
  • 1 like
  • 3 in conversation