Statalist


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

Re: st: "skipping" missing data


From   Frank Lopresti <[email protected]>
To   [email protected]
Subject   Re: st: "skipping" missing data
Date   Thu, 06 Aug 2009 11:47:13 -0400

you could impute missing data and have a flag variable = 1 if values have been imputed and then ignore the prediction if flag  == 1... 

[email protected]
Senior Faculty Technology Specialist
Data Service Studio
Statistics & Mapping 
Bobst Library/Faculty Technology Services
New York University
Bobst Library 6th Floor
70 Washington Square South
NY, NY 10012
(212)998-3398

----- Original Message -----
From: "B. Timothy Walsh" <[email protected]>
Date: Thursday, August 6, 2009 11:39 am
Subject: st: "skipping" missing data
To: [email protected]


> I am attempting to generate predictions from regressions performed for 
> each 
>  of a longish list of individuals. The problem is that, for some 
>  individuals, there are no dependent variable data (entries are 
> missing), so 
>  the regression attempt fails. The problem is that the forvalues loop 
> then 
>  exits. I would like to somehow "skip" these individuals. Loop seems 
> to work 
>  fine if there are enough data to perform a regression. I'd be 
> grateful for 
>  any suggestions.
>  
>  Here's the code:
>  generate p1=.
>  forvalues i = 1/50 {        	//50 individuals
>  	regress bperwk_ wk if ptnum == `i'
>  	predict p
>  	replace p1=p if ptnum == `i'
>  	drop p
>  }
>  
>  I'm pretty much a Stata novice. So, I apologize if I am missing 
> something 
>  obvious. Using version 10.1.
>  
>  Many thanks!
>  Tim Walsh
>  
>  *
>  *   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/
>  
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index