From: feenberg on
I have heard that I can make proc tabulate calculate the ratio of two
columns, but I can't figure out how to do it. For example if I want
the share of tax in income by year and ask for:

proc tabulate;
class year;
var income tax;
table year,income*sum tax*sum tax*pctsum<year*income>

the first two columns are income and tax by year, as expected, but the
third column is the column share - the share of that year's tax in
total tax over all years, instead of the share of tax in income. That
is, it is the same as if I had asked for:

table year,income*sum tax*sum tax*pctsum<year>

I expect I have the denominator specification wrong, but can't find
much information about that - the various tutorials only have a
sentence or two and no examples where the denominator is a sum or
mean. In the past I have always just used proc summary when I needed
the ratio of sums. Is there a way to do this in tabulate?

Daniel Feenberg
NBER
From: Mo Yang on
http://www2.sas.com/proceedings/sugi30/243-30.pdf
you can refer to the above document about proc tabulate.

On Apr 6, 9:58 am, feenberg <feenb...(a)gmail.com> wrote:
> I have heard that I can make proc tabulate calculate the ratio of two
> columns, but I can't figure out how to do it. For example if I want
> the share of tax in income by year and ask for:
>
>   proc tabulate;
>   class year;
>   var income tax;
>   table year,income*sum  tax*sum  tax*pctsum<year*income>
>
> the first two columns are income and tax by year, as expected, but the
> third column is the column share - the share of that year's tax in
> total tax over all years, instead of the share of tax in income. That
> is, it is the same as if I had asked for:
>
> table year,income*sum  tax*sum  tax*pctsum<year>
>
> I expect I have the denominator specification wrong, but can't find
> much information about that - the various tutorials only have a
> sentence or two and no examples where the denominator is a sum or
> mean. In the past I have always just used proc summary when I needed
> the ratio of sums.  Is there a way to do this in tabulate?
>
> Daniel Feenberg
> NBER