Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Beginner queston/ sum across multiple variables within one row

    Dear all,

    I am a first time Stata user for my master thesis. My dataset has 304 observations and I am working with a checklist. Each checklist step is a variable (Step1-10), that has categorical value (completed vs not completed) but is coded as 1(completed) and 0(not completed).
    My aim is to in the end be able to say that on average x/10 checklist steps were completed per observation. I thought I would start by calculating the amount of steps completed per observation. I was trying to generate a new variable for this (Checklist Score) that would give me the sum of the values over Step1-Step10 in each row.
    I tried:
    egen x=rowtotal (Step1-Step10)
    but this seemes to show me something different.

    If anyone has a tip I would be very grateful.

    Resa

  • #2
    Your new variable should vary between 0 and 10 depending on the values 0, 1 or just possibly missing in each variable. As documented missings are treated as if 0 (so ignored) except that the missing option obliges missing to be given as result if all values are missing.

    If you think you're seeing something different, please give a data example where that happens.

    Comment


    • #3
      Thank you for your reply. It does actually work with this code, I just had some accidental values of 98 for N/A in my dataset!

      Comment

      Working...
      X