Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

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 14:55:59 +0100

Perfect...thank you.

Another simple query

I have two variables 'q28income' and 'q27expenses.' 

The command 'tab q28income' gives the following table (I print only a part)

tab q28income
 q28income |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |         72       24.00       24.00
         10 |          1        0.33       24.33
         25 |          4        1.33       25.67
         30 |          1        0.33       26.00
         40 |          3        1.00       27.00

This says, for example, there are 4 houses with a total weekly income of 25 gourdes (Haiti).

The command 'tab q27expenses'gives a similar table.

Id like to have a command that will subtract the expenses from the income variable...giving me a net value for the household.

Cheers

Todd

 

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

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/

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