BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Sathish_jammy
Lapis Lazuli | Level 10

Dear Experts,

 

I used Proc tabulate procedure to solve the tally information of the given (sample dataset) table.

But I required a tally of the Percentage columns as 100%. For more details kindly go through the below information.

data aaa;
input ID age$ sex$ Emp$;
cards;
1 18-25 M Govt
2 50-60 F Pvt
6 26-35 F Govt
8 18-25 M Pvt
4 26-35 F Govt
5 36-45 M Govt
9 46-55 M Pvt
3 18-25 M Govt
0 36-45 M Govt
;
proc tabulate data = aaa;
class age sex Emp;
tables age all,Emp*(sex=' ' *(n*f=8. reppctn='%')) all='Total'*(n*f=8. reppctn='%')/rts=10;
run;

If you run the above code. It results N and % of 9 observations as Gender and Employment wise.

But I require a % column to calculate its value as 100% of its gender and employment like the Image given below.

tab.jpg

Kindly suggest the code which results in an image.

 

If you require any clarification. I will be glad to help.

Thanks in advance!

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Shmuel
Garnet | Level 18

You have used in your code REPPCT which is percentage per report.

You can use ROWPCTN to calculate row percentage or use PCTSUM to calculate column percentage.

View solution in original post

2 REPLIES 2
Shmuel
Garnet | Level 18

You have used in your code REPPCT which is percentage per report.

You can use ROWPCTN to calculate row percentage or use PCTSUM to calculate column percentage.

Cynthia_sas
SAS Super FREQ
Hi:
For purposes of completeness:
PCTN PCTSUM
ROWPCTN ROWPCTSUM
COLPCTN COLPCTSUM
REPPCTN REPPCTSUM
PAGEPCTN PAGEPCTSUM

are all the percent statistics. Using one of these depends on whether you want the percent of the count (N) or the percent of a numeric variable (PCTSUM). Look in the TABULATE documentation and note that TABULATE does an automatic multiply by 100, so you need to use a PICTURE format to get the % sign into the TABULATE output.

Cynthia

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 456 views
  • 2 likes
  • 3 in conversation