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
Help with Regression Interaction Term CommandDear all, I am using Stata 16, on mac. I need help estimating the following model Array Where educ…
not estimable margins after reghdfeDear Statalisters, I have a problem in computing the margins of a linear fixed effects regression th…
negative constant value for binary outcomeI am using the xtivreg command for a binary outcome, but the constant that Stata is producing is neg…
How to best illustrate trends/distributions of many data points?Hi everyone, I have a lot of data from an experiment and would like to find the best way to display…
Coding for three groups - cases, controls , and other diseases - What a dilemma!Hi Statalist, I am new her but I have learned a lot from you so far, so thank you all. I am using …
Subscribe to:
Post Comments (Atom)
0 Response to Use of rowmean with conditions
Post a Comment