The SAS Output Delivery System and reporting techniques

Proc Tabulate percentage column

Accepted Solution Solved
Reply
New Contributor
Posts: 3
Accepted Solution

Proc Tabulate percentage column

Hello,

 

I am trying to display percentages by year in a multi-dimensional table. Everytime I try to use the pctn I get the percent for the entire column, but I would like to get the percent Yes/No by year. Here is what I would like to see:

 

                                  2012                                      2013                               2014                   

                            Co-morbidity                         Co-morbidity                    Co-morbidity

                        No    %      Yes    %            No     %      Yes    %           No    %      Yes    %

Condition:       900   90     100    10           550   68.8    250   31.3

 

The way I have it now it is calculating the percent for the entire row for all years.

 

Thanks!


Accepted Solutions
Solution
‎03-03-2017 04:21 PM
New Contributor
Posts: 3

Re: Proc Tabulate percentage column

I figured it out... but here is how I did it if anyone else is wondering Smiley Happy

 

table condition, year *(comorb*(N pctn<comorb>*f=pct.)) all;

View solution in original post


All Replies
PROC Star
Posts: 288

Re: Proc Tabulate percentage column

Without seeing the data, it's difficult to help, but if rowpct or colpct won't do what you want, this is likely a case where you're going to have to use a custom denominator for calculating percentages.

 

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

Super User
Posts: 10,500

Re: Proc Tabulate percentage column

If you share the proc tabulate code we may be able to provide some more targetted hints. Example data and desired output would be helpful as well.

Solution
‎03-03-2017 04:21 PM
New Contributor
Posts: 3

Re: Proc Tabulate percentage column

I figured it out... but here is how I did it if anyone else is wondering Smiley Happy

 

table condition, year *(comorb*(N pctn<comorb>*f=pct.)) all;

Super User
Posts: 17,819

Re: Proc Tabulate percentage column

@mary_mcneill

 

Please mark the question as answered.

New Contributor
Posts: 3

Re: Proc Tabulate percentage column

How do I do that? I am new to the forum Smiley Happy
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 287 views
  • 0 likes
  • 4 in conversation