Announcement

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

  • rowmiss(varlist) doesn't count although varlist contains missing values

    Hi, I have created a varlist
    Code:
    global x immiyear corigin gebmonat
    containing a total of 346 variables. I checked manually whether those variables contain missing values and it turned out they do. The missing values are decoded to .a-.h. Now I want to calculate the number of missing values of each observation as a new variable as
    Code:
    egen anzmis = rowmiss(`x')
    , but it counts 0 for all observations. If I insert every singe variable instead of the varlist as
    Code:
    egen anzmis = rowmiss(immiyear corigin gebmonat)
    the code works. I followed the instructions for rowmiss and studied the STATA help but couldn't find any reason why my code doesn't work.
    Thanks for help / answers to my problem in advance!
    Tabea

  • #2
    that's because you defined a global but then referenced it as though it was a local; when you refer to a global you need to say $x rather than `x'; see
    Code:
    help macro

    Comment


    • #3
      Thank you!

      Comment

      Working...
      X