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.





Secure your spot at the must-attend AI and analytics event of 2024: SAS Innovate 2024! Get ready for a jam-packed agenda featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events.


Register by March 1 to snag the Early Bird rate of just $695! Don't miss out on this exclusive offer. 


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