BookmarkSubscribeRSS Feed
uabcms
Calcite | Level 5
Is there a way to compute a mean from a statistic other than the 'Total' N for a particular cross-tab group.
Ex. I'm looking at DRG by year and getting a sum for Total discharges, total days, income, margin, etc.
I'd like to get income and margin by day as well as by discharge. Thanks.
4 REPLIES 4
David_SAS
SAS Employee
Could you show us your current TABULATE CLASS, VAR, and TABLE statements to give us a better idea of what you're currently doing?

-- David Kelley, SAS
uabcms
Calcite | Level 5
proc tabulate missing data=final;
where fclass in ('BC','Medicare','Medicaid','Comm');
class fyr drgn drgdesc fclass;
var pats margin los nrev netinc tcost;
table drgn='DRG'*drgdesc=' ' all='Total',fclass*fyr*(pats='D/C'*sum=' '*f=5. los='Days'*sum=' '*f=6.
los='Avg LOS'*mean=' '*F=3.1
margin='Contrib Margin'*(sum=' ' mean=' ')*f=10. nrev='Net Rev'*sum=' '*f=10.
netinc='Net Inc'*sum=' '*f=10. tcost='Total Cost'*sum=' '*f=10.);


code for Margin - in bold- gives me total margin and margin by discharge(D/C) but I'd also like to get margin by Days.
Thanks.
David_SAS
SAS Employee
If you want margin and income (only) by days (only), you'll need another TABLE statement. If it's meaningful to cross everything in your TABLE statement column dimension with days, you can simply add days to your row dimension, e.g.:

drg*drgdesc days all,

Note that it's inexpensive to code multiple TABLE statements in a single TABULATE step, because TABULATE does the input data processing only once.

-- David Kelley, SAS
uabcms
Calcite | Level 5
My goal is to get a 'By day' AND a 'By discharge' value in the same table.
So for each row, I want Discharges , days, ALOS, margin, margin per day and margin per discharge.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1391 views
  • 0 likes
  • 2 in conversation