Announcement

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

  • #16
    I'm not sure whether this is what you wish:

    Code:
    gen Vacc = Immu ==1
    Best regards,

    Marcos

    Comment


    • #17
      Dear Marcos,

      Thank you for your reply.

      I got the same results as when I used the commands in #15. The missing observations are treated as no and takes on 0 for the dummy.

      Kind regards.

      Comment


      • #18
        if I correctly understand #15, your second statement is incorrect; you write,
        replace Vacc=0 if mi(Vacc)
        but you should be writing:
        Code:
        replace Vacc=0 if Immu!=1 & Immu!=.
        replace Vacc=. if Immu==.
        note that since you did not provide a data example, I can't be sure that you need both of those (or that they are correct), but your code does exactly what you don't want

        Comment


        • #19
          I’m really in doubt if the query is clear to me. In short, if you wish ‘1’ for yes and rest as missing values, you just need to apply the first line of the code you shared, and forget about ‘replace’. If it is the opposite way, you can you the command I shared.
          Best regards,

          Marcos

          Comment


          • #20
            Dear Marcos,

            Thanks so much.

            I've figured it out. Thanks again.

            Regards

            Comment

            Working...
            X