This is something that I have been Googling but couldn't find an answer to.
I need to generate a new variable by using the command rowmean but with a condition that the respondent should have answered at least 4 questions/variables
my code is egen newvar = rowmean (var1 var2 var3 var4 var5 var6)
This is obviously wrong because I dont have the condition of taking the mean ONLY if the respondent has an answer to at least 4 of these variables
Hope someone can help! Thanks!
Related Posts with Use of rowmean with conditions
Aggregate individual-level data into household-level dataHi. I am working with a survey that gathers information on an individual level. The survey asks all …
predicting effectDear colleagues I'm thinking of a method to isolate the effect of a particular variable (X) on say …
Generate a new date variable from a panel dataDear all, I tried coding (see below) to generate a new date variable in month from a large panel dat…
Panel Data: Comparison of ObservationsHello, I would like to specify a variable that indicates the ratio of new names to the total number …
Equivalent command to Ctsem in STATA ?Dear honourable members, Please I would like to know if in STATA there is an equivalent command to …
Subscribe to:
Post Comments (Atom)
0 Response to Use of rowmean with conditions
Post a Comment