Hello,
I am working with a data set where the variables represent questions from a survey that used a Likert scale. The values for each variable are integers ranging from 1-4 for responses ranging from strongly disagree to strongly agree. The number 5 is used for the response N/A and 6 was used when there was no response (i.e. missing). I need to find the sum of the responses for all of the questions/variables but only if the response is between 1 and 4. I know the rowtotal command will give me the sum for each observation across all the variables but I only want the total to include the values 1, 2, 3 and 4, not the values 5 or 6. For instance, using the numbers in the image below, the sum for the first row should be 16, but the sum for the fifth row should be 7 (because I'm not including the 5s). I know I can't use an if statement so, is there any way to do this?
Thanks.
Related Posts with Summing across variables with conditions
Five-Year Running Average by Country-YearHi all, I'm a new user to Stata. I have a dataset with a variable for different countries and years,…
Questions regarding etregress commandHi all, I have a few questions regarding etregress command, since I intend to incorporate that into…
Efficient ways to increment dates by given intervalI am trying to achieve what I believe should be a relatively straight-forward task, which is to incr…
Variable Names StataI am trying to download a CSV into stata14, however I do not want stata to read the first row as var…
panel regression analysis and skewed dataI am working with panel data and use xtlogit command to conduct multivariate regression analysis. Fo…
Subscribe to:
Post Comments (Atom)
0 Response to Summing across variables with conditions
Post a Comment