Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: displaying variable names for which obs are missing, by row


From   Radu Ban <[email protected]>
To   <[email protected]>
Subject   st: displaying variable names for which obs are missing, by row
Date   Tue, 6 May 2003 14:31:02 -0400 (EDT)

dear all,

i want to obtain a listing of the variables that have missing
observations, by row. more explicitly, the dataset looks like (on a much
larger scale)

id 	var1	var2	var3
a1	x	.	.
a2	y	z	.
a3	.	t	u

so i want to obtain an output of the form:

a1
var2
var3

a2
var3

a3
var1

i tried with the following piece of code:

local N = _N
forvalues i = 1/`N' {
	l accid in `i', noobs
	foreach j of local vlist {
		l `j' if `j' == . in `i', noobs
	}
}


but the problem is that this code lists all the variables for each id,
even if they are not missing. the only difference is that when the
variable is missing the actual "." is listed, while when it's not missing
only the name is listed. thus it is hard to pick up the desired variables
just by looking at the log file.

does anyone have any suggestions?

thanks in advance,

radu ban



*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index