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

From |
"Nick Cox" <n.j.cox@durham.ac.uk> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: RE: egen mean excludign any variable with missing values |

Date |
Mon, 8 Jun 2009 12:09:36 +0100 |

Yet another answer is to point out that the -if- condition can be written ... if !missing(y,x1,x2,x3,x4,x5,x6,x7,x8) Nick n.j.cox@durham.ac.uk Mandy fu I was wondering if anyone could give me some suggestion about following question related to --egen-- command. I want to demean variables Y, x1-x8 and then run an OLS regression of these variables for a panel data set for respondents. I think I need to be careful with the missing values in these variables. I'm not sure to exclude any respondent who has missing values for any of the variable in Y, x1-x8 when calculating the group mean for each respondent. **get the group mean (using id as group) without taking consideration of mising values foreach v of varlist Y x1-x8 { by id: egen mean_`v'=mean(`v') } In order to exclude the respondents with missing values for any variable in Y, x1-x8, of course I can write out the condition like Y<. & x1<. & x2<. ....................... I 'm sure there should be some easy way. Could anyone give me some hint? * * 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/

**References**:**st:egen mean excludign any variable with missing values***From:*Mandy fu <mandy.fu1@gmail.com>

- Prev by Date:
**Re: st: Log Normality of Dependentvar** - Next by Date:
**st: kmeans clustering -initial starting points** - Previous by thread:
**Re: st:egen mean excludign any variable with missing values** - Next by thread:
**RE: st:egen mean excludign any variable with missing values** - Index(es):

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