Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Subtotals


From   Daniel M�ller <[email protected]>
To   <[email protected]>
Subject   st: RE: Subtotals
Date   Wed, 28 Aug 2002 12:25:14 +0200

if I understand your questions right:

bysort year: gen ind=_n
bysort year ind: egen total1=sum(age0)
keep if ind==1
drop ind

Daniel

> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of
> [email protected]
> Sent: Wednesday, August 28, 2002 11:10 AM
> To: [email protected]
> Subject: st: Subtotals
> 
> 
> Helloe Statalisters,
> I run a do file which creates a table similar to the following
> 
> year total age0 ......
> 1991 123   3
> 1991  57    4
> 1991  29    3
>    .      .      .
>    .      .      .
>    .      .      .
> 1991 109    4
> 1992 129    6
> 1992  84     2
>    .      .      .
>    .      .      .
>    .      .      .
> 2000   97    5
> 
> I wist to convert this table into another table totalling all columns for
> each year i.e.
> 
> Year Total Age0
> 1991 1026   23
> 1992 1247   37
> 1993 1067   19
>    .       .       .
>    .       .       .
>    .       .       .
> 2000   957    27
> 
> Any advice and pointers to literature would be most appreciated,
> Thanks
> 
> Christopher D Fergusson
> 
> 
> *
> *   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/
> 
> 
*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index