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
20.00
0 93.3 57.6 34.2 23.7 20.5 19.3
1 5.7 26.5 26.5 22.1 21.1 20.8
2 1.0 11.2 24.5 30.0 29.0 29.5
3 .0 4.6 14.8 24.3 29.3 30.3
30.00
0 88.7 44.9 24.3 16.7 15.2 14.9
1 9.1 27.8 20.1 17.0 15.4 15.5
2 1.1 19.7 30.3 28.8 28.6 28.4
3 1.1 7.7 25.3 37.5 40.8 41.1
40.00
0 82.2 41.2 19.5 13.3 11.4 11.3
1 14.6 26.3 20.0 14.2 13.8 12.9
2 2.6 25.8 39.6 43.9 43.0 43.6
3 .5 6.7 20.9 28.6 31.7 32.2
50.00
0 84.4 50.4 29.3 19.3 14.4 .
1 10.8 23.2 19.6 16.8 16.8 .
2 4.3 19.0 33.4 38.6 41.7 .
3 .5 7.4 17.6 25.3 27.1 .
60.00
0 84.5 60.5 33.9 . . .
1 12.2 18.3 21.3 . . .
2 3.2 15.6 25.4 . . .
3 .2 5.6 19.5 . . .
70.00
0 85.8 . . . . .
1 11.5 . . . . .
2 2.7 . . . . .
Stephen
----------------------
Professor Stephen P. Jenkins <[email protected]>
Institute for Social and Economic Research (ISER)
University of Essex, Colchester, CO4 3SQ, UK
Tel: +44 (0)1206 873374. Fax: +44 (0)1206 873151.
http://www.iser.essex.ac.uk
*
* 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/