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
Herfindahl-Hirschman Index, command ignores existing valuesHello! I am a PhD student in International Business and Economics. I am studying MNEs. I would like…
How to run the rank-based and sign-based variance-ratio test in stata?Hi. I want to test the random walk hypothesis by using rank-based and the sign-based variance-ratio …
Function to count categorical dataI have a database containing company names (company_name) and company countries of origin (company_o…
Getting the underlying data from LROCI have run a probit model and then used the command -lroc to draw a ROC curve. I want to extract the…
Poisson pseudo maximum-likelihood in a Diff-in-Diff analysisHi Everyone, I am performing a Diff-in-diff analysis using an outcome with many zeros in the panel …
Subscribe to:
Post Comments (Atom)
0 Response to Summing across variables with conditions
Post a Comment