Announcement

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

  • Summerizing a string variable through loops

    Hi statalisters,

    I would really appreciate if someone could help me solve my problem below.
    In my dataset i have many test results per patient. I am interested to summarize the total number of positive results per patient through the loop.
    So far I have created a loop for all result variables called results which represent b_leg_res* and I can count the number of positives per variable but not per person. However, I don't know how to summarize the total number of pos per person through the loop and record it in the no_pos variable. Can anyone help me with this ?


    gen no_pos=.

    foreach results of varlist b_leg_res* {
    count if `results' =="Pos"
    }


    Thank you,
Working...
X