James - I don't know if you call this an easy way, but it works. I hope
someone can do it better.
Keith
. list, clean
a b x
1. 0 0 15
2. 0 1 11
3. 1 0 20
4. 1 1 24
tempfile a b ab
preserve
collapse (sum) x, by(a)
save `a'
restore, preserve
collapse (sum) x, by(b)
save `b'
restore, preserve
collapse (sum) x
save `ab'
restore
append using `a'
append using `b'
append using `ab'
At 04:38 PM 18/4/05, you wrote:
Dear all:
Is there any easy way to transfer the following data
0 0 15
0 1 11
1 0 20
1 1 24
into
0 0 15
0 1 11
1 0 20
1 1 24
0 . 26
1 . 44
. . 70
. 0 35
. 1 35
Apparently, the added records with "." are the marginal totals and grand
total. This question is related to the example given in the Programming
Manual about tabdisp & collapse.
Thanks.
James
Email: [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/
==========================================================
Dr Keith B.G. Dear
Senior Fellow in Biostatistics
National Centre for Epidemiology and Population Health (NCEPH)
The Australian National University
Canberra, ACT 0200, Australia
Tel: 02 612 54865, Fax: 02 612 50740
http://nceph.anu.edu.au/Staff_Students/staff_pages/dear.php
CRICOS provider #00120C
*
* 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/