# Re: st: Sums and means within a table

 From Phil Schumm <[email protected]> To [email protected] Subject Re: st: Sums and means within a table Date Thu, 18 Jan 2007 04:51:28 -0600

```On Jan 18, 2007, at 3:44 AM, Todd Swarthout wrote:
```
Hello. I have the following table:

tab Q1_1reparti
Q1_1reparti | 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

You're correct (it is simple):

sum Q1_1reparti
di r(sum)

will give you both the mean number per household and the total number across households. Use -help summarize- for the online help or see the entry on -summarize- in the manual.

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).

I believe the total number of children in the table above is 274 (not 279).

-- Phil

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