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
LCA gsem output tables and intercept significanceHello dear all, I was trying to understand the output tables especially the first one, mlogit model …
Stata update error: 'Could not move java to .old/' r(695)Greetings, I'm running Stata 15.1 on OSX. I really bought a new computer and (using OSX's 'migratio…
Create a var with some conditions in a same columnHi, I want to create a var with some conditions in a same column. For example, This is the origina…
ML estimation goes forever in longitudinal analysisHi statisticians, I am running a saturated model (-mixed-) for preliminarily assess the effect of i…
Significance levels of combined coefficientsDear Stata users, My regression looks as follows: y = x0 x1 x2 x3 x4 x5 Where x4 = x3 * dummy (ind…
Subscribe to:
Post Comments (Atom)
0 Response to Use of rowmean with conditions
Post a Comment