Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 65044

List of variables with missing values

$
0
0
Hello
I am new to Stata and I'm currently studying the language. I have been able to do some stuff but I can't seem to do this in a optimized way.
For simplification ,let's say I have:

x1 x2 x3 x4
8 5 3 1
5 . 3 9
6 1 3 6
4 . . 8

I want to list all variables that has a missing value:
x1 x2 x3 x4
5 . 3 9
4 . . 8


I could do
Code:
list x1 x2 x3 x4 if missing(x1) | missing(x2) | missing(x3) | missing(x4)
but for large datasets this seems pretty annoying. How could I do it with a foreach command?
Thanks in advance.

Viewing all articles
Browse latest Browse all 65044

Trending Articles