Check the funcion in the egen package <sum> and use it together with by,
by HH: egen hh_inc=sum(tot_inc)
--------------------------------------------
Universidad Alberto Hurtado
ILADES / Georgetown University
Erasmo Escala 1835
Santiago, Chile
Phono: 671-7130 anexo 267
http://www.ilades.cl/economia/index.html
----- Original Message -----
From: "Rodrigo Brice�o" <[email protected]>
To: "Statalist (E-mail)" <[email protected]>
Sent: Wednesday, January 15, 2003 3:48 PM
Subject: st: adding data for identical individuals
> Hello statalisters. I don't want to annoy anyone with my doubts, but you
are
> the only that can help me. I try to explain clearly my doubt and at the
end
> I write some mini example.
>
> I have a database with incomes and a database with socioeconomic
> characteristics of individuals. The income database has 9,000 records and
> the socioeconomic has 19,000. I merged the two databases using some unique
> identifiers between the two databases.
>
> With the new database I need to construct a new variable called (income
> deciles) and for this I need the total income for the household (assigned
to
> each individual of the household). The problem is that not every
observation
> (in the new database) corresponding to the same household has income
> observations in the merged database (it could be the childrens, people
with
> no reported income, etc).
> I already think in a procedure to make my statistical analysis right:
> To add incomes for each household due to the fact that each household
could
> have several sources of income (salaries, transfers, etc.) First of all I
> don't know how to add those values (a new variable independent of the
source
> I guess) neither how to assign the sum (for each household) to each of the
> members of the household. I require this to make the deciles.
> Can somebody help me with the commands or the steps that I need to do.
>
> Example:
> HH Member Age Sex SourceIncome Total Income
> 1 1 37 1 11 1500
> 1 1 42 2 11 3000
> 1 1 42 2 53 400
> 1 2 14 2 . .
> 1 2 25 2 . .
>
> You can find identical observations in the variable "member" because is
> possible that each household is composed by several families.
>
> Rodrigo Brice�o
>
>
>
> *
> * 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/
______________________________________
Universidad Alberto Hurtado
http://www.uahurtado.cl
*
* 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/