Stephen P. Jenkins
>
> I have a large number of categorical variables named
> "agekst*" (where *
> are integers), where each variable is coded using the same frame (4
> categories: 0,1,2,3). The variables summarise the number of
> children a
> woman has had by each age (the elements of *). I would like
> to tabulate
> the percentages in each agekst* category -- these are
> straightforward
> to derive using -tabulate- and e.g. -foreach-. But how can
> I report the
> percentages in a summary table in which there is a column for each
> variable and the rows are the col percentages? (Or, alternatively,
> there are rows for each variable, and the col percents on
> agekst* form columns.)
> I also know each woman's birthdate, summarised in a categorical
> variable named "cohort" (8 categories), and it would be
> nice to able to
> repeat the summary table for each value of cohort.
> [I've looked at -collapse-, -table-, and their relatives, and none
> appear to be what I require.]
> Suggestions please!
> In essence I am asking how I might use Stata to reproduce
> output that the SPSS REPORT command produces. Here follows an
example
> of what SPSS can do:
>
> SPSS Code & Output
> ------------------
> sort cases by cohort.
> report /format= colspace(1) nolist margins(1)
> /variables= cohort agekst20 agekst25 agekst30 agekst35
> agekst40 agekst45 (6)
> /break= cohort
> /summary=percent(0,3).
>
> ************output***************************************
> COHORT AGEKST20 AGEKST25 AGEKST30 AGEKST35 AGEKST40 AGEKS45
> .00
> 0 92.1 64.3 40.2 27.5 22.0 21.1
> 1 6.7 25.0 33.7 30.4 23.1 21.6
> 2 1.2 8.7 20.5 27.4 32.5 32.9
> 3 .0 2.0 5.7 14.7 22.4 24.4
> 10.00
> 0 95.0 67.6 36.6 22.5 20.6 20.1
> 1 4.8 23.1 32.2 26.7 23.0 22.7
> 2 .3 6.8 21.3 29.4 29.3 28.3
> 3 .0 2.5 9.9 21.4 27.1 28.9
I guess your main way forward is -reshape- so that
the agekst* are all stacked into one variable.
Nick
[email protected]
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/