Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Generating missings/dropping specific data based on one variable
From
Ronnie Babigumira <[email protected]>
To
[email protected]
Subject
Re: st: Generating missings/dropping specific data based on one variable
Date
Mon, 23 Apr 2012 10:50:02 +0200
Showing some data would help but anyway, here is an hypothetical example.
Two variables, "howmuch" should only be answered by those who answered yes (1) in the variable "didsth"
id didsth howmuch
1 1 82
2 0 .
3 0 6
4 1 54
5 1 92
6 0 34
7 1 .
gen perror = didsth == 0 & howmuch !=. // Or however you coded not applicable
gen truemis = didsth == 1 & howmuch ==.
If your interest is in real missing's (didsth is yes but you have no data on howmuch), then look at truemis. If you are looking for potential data entry errors, look at perror
Ronnie
--
010100100110111101101110011011100110100101100101
On Monday, April 23, 2012 at 10:27 AM, Nina Bjerre Andersen wrote:
> Dear Statalist-subscribers
>
> I have the peculiar problem of having to generate missings:
> I have a dataset based on web-based questionnaire data, where some observations now include data on variables where they should be missing, i.e. some participants should not have been invited to answer those particular questions based on a "yes/no"-question given on another variable.
> I therefore wish to generate missings, but I am finding that
> - using -drop- I am only allowed to drop entire observations
> - using -mvdecode- I can only generate missings based on the value of the variable itself.
>
> Hoping someone can help,
>
> Best regards
>
> Nina Bjerre Andersen
> Scholar
> Centre for Medical Education
> Aarhus University, Denmark
> [email protected]<mailto:[email protected]>
>
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/