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 !!!
| All | A | B | C | D | E | F | G | All% | A% | B% | C% | D% | E% | F% | G% | |
| Z | 356 | 69 | 36 | 19 | 69 | 15 | 59 | 89 | 356/1002 | 69/356 | 36/356 | 19/356 | 69/356 | 15/356 | 59/356 | 89/356 |
| Y | 371 | 32 | 7 | 90 | 87 | 29 | 47 | 79 | 371/1002 | |||||||
| X | 275 | 46 | 49 | 31 | 35 | 94 | 14 | 6 | 275/1002 | |||||||
| Total | 1002 | ## | 15 | 83 | 33 | 96 | 60 | 93 |
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;
One of the below two links might give you an idea:
https://support.sas.com/resources/papers/proceedings13/134-2013.pdf
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;
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;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
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!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.