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

st: Egen functions - preserving missing values?


From   "Deborah Garvey" <DGarvey@scu.edu>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Egen functions - preserving missing values?
Date   Thu, 06 Oct 2005 13:00:03 -0700

Hi, all.

I'm using US 2000 Census data (IPUMS version, with my edits).  I've hit upon an issue I don't find much <help> on:  how to preserve missing values when these are qualitatively different from zero values when using an <egen> function.

I have individual-level income income data (inctot2) that I want to aggregate within families (famunt2) in a household (serial):

egen ftoty=sum(inctot2), by(serial famunt2)

The issue: ftoty is zero, even when all family members have inctot2==. (i.e., not reported, for example, due to age).  In my application (determining family income relative to a poverty threshold) zero family income is very different from nonreported family income.

One work-around is to use the !missing(varname) construction, which sets ftoty to missing for any person with missing inctot2:

 egen ftoty=sum(inctot2) if !missing(inctot2), by(serial famunt2)

The drawback to this approach is that I must go back and assign non-missing values of ftoty to individuals for whom ftoty is missing, but who live in a family where other individuals report a valid income value.

Is there a better way to approach this problem?  

Best,  Deborah Garvey

******************************
Deborah Garvey, Ph.D.
Department of Economics
Kenna Hall
Santa Clara University
Santa Clara, CA  95053
408/554-5580
408/554-2331 (FAX)
dgarvey@scu.edu    
http://lsb.scu.edu/~dgarvey
**********************************


This message scanned for viruses and SPAM at SCU (MGW2)

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index