# RE: st: Sums and means within a table

 From "Todd Swarthout" <[email protected]> To <[email protected]> Subject RE: st: Sums and means within a table Date Thu, 18 Jan 2007 11:04:34 +0100

```Thanks but if I enter the command

-bysort idno: sum q1_1rparti-

I get a table like the following...

idno = 2
Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
q1_1rparti |         1           1           .          1          1

That is, I get a summaary of each of the 298 households for this one query.

Im looking for the total number of children in this table (279 in this case, as I did it in excel) and the average per houehold (1,1 children...298/279).

Any other ideas

Thanks

Todd

-----Message d'origine-----
De : [email protected] [mailto:[email protected]] De la part de [email protected]
Envoy� : jeudi 18 janvier 2007 10:43
� : [email protected]
Objet : Re: st: Sums and means within a table

try to:
bysort hid: sum children
where hid is the identification the household

Quoting Todd Swarthout <[email protected]>:

> Hello. I have the following table:
>
> tab Q1_1r�parti
> Q1_1r�parti |      Freq.     Percent        Cum.
> ------------+-----------------------------------
>           0 |        133       44.63       44.63
>           1 |         85       28.52       73.15
>           2 |         58       19.46       92.62
>           3 |         17        5.70       98.32
>           4 |          3        1.01       99.33
>           5 |          2        0.67      100.00
> ------------+-----------------------------------
>       Total |        298      100.00
>
> This is the number of children in a household under 5 yrs of age.
> For example, there are 133 households with 0 chilfren <5 yrs. Im
> looking for a command that will allow me to sum the total number of
> children in all 298 households and then to find the average number
> per household.
>
> A rather simple command I suspect
>
> Thanks
>
> *
> *   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/

*
*   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/
```