I have 3 variables that I want to construct an aggregate variable with:
racfew
rachaf
racmost
I have (.i) for some (missing values)
The new variable I want to construct is Racpeers= racfew + rachaf + racmost
How can I have Racpeers = .i (missing) only if all three variables (racfew, rachaf and racmost) are .i? If say one or two of the three is missing I want to assign .i= 0.
In other words, say I have a value of 2 for rachaf and .i for both racfew and racmost, I want Racpeers = 2.
But if I have racfew, rachaf and racmost = .i , I want to have Racpeers = .i or drop the observation for that variable.
How can this be done?
Related Posts with How to delete specific observations?
Reshape wide to long over various attributesI have a dataframe that looks like so: Q1_2008_East Q1_2008_West Q2_2008_East Q2_2008_West .....…
Calculating the share of respondents with certain preferences in Discrete Choice Experiments -mixed logitDear Stata users, I have been trying to replicate the following paper from Arne Risa Hole (2007) : …
Regression models with exposure, outcome, and GROUP of covariates in one loopHi All - just struggling to get some basic regression code to work how I want it in Stata. Imagine i…
overlaying histograms produce "empty" part on x-axisDear all, I am making a plot consisting of overlaying histograms. My data ranges from -9 to 14. Eve…
GLM and SQREG heteroscedasticity analysisHi all, I'm trying to analyse the heteroscedasticity posteestimation of my two possible models regre…
Subscribe to:
Post Comments (Atom)
0 Response to How to delete specific observations?
Post a Comment