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

st: RE: Printing an error list


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Printing an error list
Date   Tue, 21 Jan 2003 17:11:19 -0000

Chau Tak Wai
>
> First, thank you very much for the intelligent methods suggested for
> updating my dataset.
>
> Now, I have another problem. I would like to produce an
> error list by
> variable. I try to use the following command variable by variable:
>
> list id x1 if (condition for x1 to have problem)
>
> However, the problem is that, even no observation has
> problem, there are
> still some output. (command and header -- id x1 ) Since there are
> hundreds of variables involved in this household servey and
> the report
> will be very long if I retain those lines. Deleting them
> manually one by
> one is also quite time-consuming. Do you know any more
> efficient methods
> that I can perform the above task?


This is a large area. Two suggestions only:

I like using -assert- to assert what should be true.

You can -capture- its result and -list- conditional
on there being a problem.

capture assert sex == 0 | sex == 1
if _rc {
	list sex if !(sex == 0 | sex == 1)
}

Alternatively, tag problems and save the -list-
until later.

gen problem = <x1 shows problem 1>
replace problem = problem | <x1 shows problem 2>
.
.
.
list if problem

Nick
[email protected]

*
*   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