|
|
can proc tabulate do the ratio of sums?
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
|
|
0
|
|
|
|
Reply
|
feenberg
|
4/6/2010 2:58:11 PM |
|
http://www2.sas.com/proceedings/sugi30/243-30.pdf
you can refer to the above document about proc tabulate.
On Apr 6, 9:58=A0am, feenberg <feenb...@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:
>
> =A0 proc tabulate;
> =A0 class year;
> =A0 var income tax;
> =A0 table year,income*sum =A0tax*sum =A0tax*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 =A0tax*sum =A0tax*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. =A0Is there a way to do this in tabulate?
>
> Daniel Feenberg
> NBER
|
|
0
|
|
|
|
Reply
|
Mo
|
4/6/2010 7:31:34 PM
|
|
|
1 Replies
688 Views
(page loaded in 0.576 seconds)
|
|
|
|
|
|
|
|
|