BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
mary_mcneill
Obsidian | Level 7

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!

1 ACCEPTED SOLUTION

Accepted Solutions
mary_mcneill
Obsidian | Level 7

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

 

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

View solution in original post

5 REPLIES 5
collinelliot
Barite | Level 11

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

ballardw
Super User

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.

mary_mcneill
Obsidian | Level 7

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

 

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

Reeza
Super User

@mary_mcneill

 

Please mark the question as answered.

mary_mcneill
Obsidian | Level 7
How do I do that? I am new to the forum 🙂

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

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

View all other training opportunities.

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