BookmarkSubscribeRSS Feed
Quartz | Level 8

I have the following table:


Screen Shot 2023-04-17 at 12.06.51.png

Suppose to look at Drug3 dosage 0.75 and 1.5. Is there a way with proc tabulate or another proc to compute the percentage on 21520 + 34732? In other words, the percentage for 0.75 should be 21520/(21520 + 34732)=38% and for 1.5 should be 34732/(21520 + 34732)=61%

Thank you in advance

Super User
I think PROC SQL can do that.
Can you post your data and the output you want?
Super User

Please show your existing Proc Tabulate code.


If you do not want the missing values for your dosage_3m variable included in the denominators for Pctn calculations then you need to exclude them, such as not include MISSING on the class statement for that variable.


If you want to include the missing then you will have to modify the data and pick another approach to get something like this in proc tabulate. One approach would be to add another variable has a value of 1 only when Dosage_3m is not missing and then use that variable as a Var variable and ColPctSum with that variable instead of ColPctN of the Class variable.





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!

From SAS Users blog
Want more? Visit our blog for more articles like these.
5 Steps to Your First Analytics Project Using SAS

For SAS newbies, this video is a great way to get started. James Harroun walks through the process using SAS Studio for SAS OnDemand for Academics, but the same steps apply to any analytics project.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 3 in conversation