Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Missing value problem with new variable


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Missing value problem with new variable
Date   Tue, 11 Sep 2012 10:39:03 +0100

I guess that the problem is not whether -occupation- is ever missing.
It is whether every household has someone for whom -relationshiptohhh
== 1-.

You can check that by e.g.

egen nohhh = total(relationshiptohhh == 1), by(SRLNO sites)

and looking for zeros.

Also your code is contradictory. If -Q1_1_7- is the right variable,
why use -occupation-?

Nick

On Tue, Sep 11, 2012 at 10:20 AM, Wameq Raza <wameq.r@gmail.com> wrote:

> For my data set that deals with health seeking behavior for a acute
> illnesses, I've been trying to include the occupational details of the
> household head for each of the patients who seek care. More
> specifically, I want to create a variable where the occupation of the
> household head is stored for every individual in the household.
>
> To do this I've followed these steps:
> 1. gen emp_hhh=occupation if relationshiptohhh==1           /where
> Q1_1_7 is the occupation variable (categorical variable) and
> relationshiptohhh equals to 1 if it's the head of the household
> 2. bysort SRLNO site: egen emp_hh = max(emp_hhh)        /where "SRLNO
> site" are the ID variables for each household.
>
> My understanding is that the new var "emp_hh" should have what I want,
> but there seems to be a number of missing values. I've checked the
> original occupation var for missing values from which the new var was
> constructed, but there were none. Might there be something wrong with
> my syntax?
>
> I'm having a similar problem with the education variable as well.
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index