Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: st: Indicating whether a family is nuclear or extended for all
From
"Ntshebe O." <[email protected]>
To
"[email protected]" <[email protected]>
Subject
RE: st: Indicating whether a family is nuclear or extended for all
Date
Wed, 24 Jul 2013 15:06:22 +0000
Using the following worked, thanks
bys HHId:g fam=_N>1
egen maxrel=max(p05), by (HHId)
g nuclear=maxrel <3 & fam
br HHId p05 maxrel fam nuclear
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Chamara Anuranga
Sent: 22 July 2013 15:39
To: [email protected]
Subject: Re: st: Indicating whether a family is nuclear or extended for all
Dear Oleosi,
Assuming that your previous variables nuclear and extended are correct I suggest you to create a tag variable on the dataset.
egen taghh=tag(HHId)
Then,
total nuclear if taghh==1
total extended if taghh==1
you can use this tag variable with other commands and get same result (such as table, count)
Thanks,
Chamara
On Mon, Jul 22, 2013 at 7:47 PM, Ntshebe O. <[email protected]> wrote:
> Dear Statalist
> I wish to generate a variable indicating whether a household is nuclear or = extended for all members.
> I am using the variable p05(relationship to household head), HHId identifi= es the household and totalhh is the household size.
> See attached below:
> (p05)
> 0 Head
> 1 Spouse
> 2 Son or Daughter
> 3 Child In-law
> 4 Step child
> 5 Grandchild
> 6 Parent
> 7 Parent In-law
> 8 Grand Parent
> 9 Brother or Sister
> 10 Nephew or Niece
> 11 Uncle or Aunt
> 12 Other relative
> 13 Not related
>
> bys HHId: gen nuclear=0 if _N >1
> replace nuclear=1 if p05==0|p05==1|p05==2 replace nuclear=. if p05==.
> tab nuclear generation
> tab nuclear totalhh
> br HHId p05 nuclear
> label variable nuclear "nuclear family"
> label define nuclear 1 "yes" 0 "no"
>
> bys HHId: gen extended=0 if _N >1
> replace extended=1 if |p05==3|
> p05==4|p05==5|p05==6|p05==7|p05==8|p05==9|p05==10|p05==11|p05==12|p05=
> =13
> replace extended=. if p05==.
> tab extended
> label variable extended "extended family"
> label define extended 1 "yes" 0 "no"
>
> I did the above, but I am not sure how I make the count for nuclear or
> extended families appear the same for members of the same household. A household can either be nuclear or extended.
> Thanks.
>
> Oleosi
>
>
>
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/faqs/resources/statalist-faq/
> * http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/