Dear Stata users,
I would like to count the number of missing observations in a variable
-var1- of my dataset and perform cetain operations based on the count.
To do this I entered
count if var1 == .
and I get a number, lets say 40: However, when I wanted to compare
the output of count (here 40) with another number such that:
if count <=50 {....
I receive error message saying that stata could not find count. How
can I assign a name to the output of the count command?
thanks a lot
Sarah
If you do -return list- after the -count- command, you'll see that the
value computed by -count- is stored in r(N). So, do something like
count if missing(var1)
if r(N) <= 50 {...