## tabulate

Occasional Contributor
Posts: 19

# tabulate

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.
SAS Employee
Posts: 174

## Re: tabulate

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
Occasional Contributor
Posts: 19

## Re: tabulate

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.
SAS Employee
Posts: 174

## Re: tabulate

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
Occasional Contributor
Posts: 19