Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: RE: Identifying the nearest observation in a household survey


From   "Richard Palmer-Jones" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: Identifying the nearest observation in a household survey
Date   Thu, 21 Apr 2005 17:44:20 +0100

This won't work if you have more than one child per previous parent.
You can identify children, then loop back observation by observation till
you get to a likely parent - though identifying them may be difficult and
unclear (guardians) - and watch out for child headed households? With a
health warning: 
gen parent = .
gen child if age < 18
qui des
foreach i in 1/r(N) {
	if child == 1 {
		local j = 1
		local parent = 0
		while `parent' < 1 {
			if age[`i' - `j'] = [condition for parent - your
business]
				parent[`i'] = serial[`i'-`j'] * 100 +
pernum[`i'-`j']
				local parent = 1
			}
			local ++j
		}
	}
}
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Scott Merryman
Sent: Thursday, April 21, 2005 2:00 AM
To: [email protected]
Subject: st: RE: Identifying the nearest observation in a household survey

> -----Original Message-----
> From: [email protected] [mailto:owner-
> [email protected]] On Behalf Of Deborah Garvey
> Sent: Wednesday, April 20, 2005 7:32 PM
> To: [email protected]
> Subject: st: Identifying the nearest observation in a household survey


<snip>
> I
> want the adult who is listed before the child in the household record,
> since Census/sociology research shows he/she is most likely to be the
> parent.
> 
> An example:
> 
> serial     pernum     nfams     famunit famsize   related              age
> sex  marital
> 2411276          1         6           1            1   Head/Householder
> 88   F  widow
> 2411276          2         6           2            1   Other non-
> relatives 49   M single
> 2411276          2         6           3            2   Other non-
> relatives 49   M married
> 2411276          3         6           3            2   Other non-
> relatives  42  F  married
> 2411276          4         6           4            1   Other non-
> relatives    6  F  single
> 2411276          5         6           5            1   Other non-
> relatives  68  F widow
> 2411276          6         6           6            1   Other non-
> relatives  58  M widow
> 
> The child in line #4 is most likely the child of #2 and #3.  Can someone
> help me get started?  I'm running Stata/SE 8.2, Windows, born 1/10/05.
> 

Do you mean something like this?

. l serial relate age sex marital , abb(32) noobs

  +--------------------------------------------------+
  |  serial            related   age   sex   marital |
  |--------------------------------------------------|
  | 2411276   Head/Householder    88     F     widow |
  | 2411276              Other    49     M    single |
  | 2411276              Other    49     M   married |
  | 2411276              Other    42     F   married |
  | 2411276              Other     6     F    single |
  |--------------------------------------------------|
  | 2411276              Other    68     F     widow |
  | 2411276              Other    58     M     widow |
  +--------------------------------------------------+

. mark child if age <18

. mark parent_of_child if age>=18 & child[_n+1] == 1

. l serial  age sex marital child par, abb(32) noobs

  +---------------------------------------------------------+
  |  serial   age   sex   marital   child   parent_of_child |
  |---------------------------------------------------------|
  | 2411276    88     F     widow       0                 0 |
  | 2411276    49     M    single       0                 0 |
  | 2411276    49     M   married       0                 0 |
  | 2411276    42     F   married       0                 1 |
  | 2411276     6     F    single       1                 0 |
  |---------------------------------------------------------|
  | 2411276    68     F     widow       0                 0 |
  | 2411276    58     M     widow       0                 0 |
  +---------------------------------------------------------+



Scott



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