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

Re: st: missing values


From   Richard Williams <[email protected]>
To   [email protected]
Subject   Re: st: missing values
Date   Thu, 22 Sep 2005 02:05:02 -0500

At 01:11 AM 9/22/2005, NEYMOTIN, FLORENCE wrote:
Here are my exact commands.

replace sswlnw_1 = .a if (yob > 1912 & a_age > 69)
replace sswlol_1 = .a if (yob > 1912 & a_age > 69)
replace sswlnw_2 = .a if (yob > 1912 & a_age > 69)
replace sswlol_2 = .a if (yob > 1912 & a_age > 69)

If I use . instead of .a, 0 changes are made. (With .a, 57981 changes re made)

If I say gen dummy = 0
replace dummy = 1 if (yob > 1912 & a_age > 69)
then 57891 changes are made...
A couple of points:

1. Do sswlnw_1, etc., already = . before the replace command? If so, they won't get changed if you tell Stata to replace . with . They will get changed if you replace . with .a. Similarly, on your gen dummy command, dummy = 0 will get changed to 1 if the condition is true. But, if you had said gen dummy = 1, then the replace command would not change anything.

In short, you need to check what the MD status of your vars is before the replace command.

2. Recall that yob > 1912 will be true if yob is missing. Same for a_age > 69. Is that what you want? If not, you need to modify your if condition so that it is not true when these vars are missing.

I may be on the wrong track here (a definite possibility at 2 AM!) , but just based on what you have shown it need not be the case that Stata is malfunctioning. You need to do some additional checking first and, if you still think there is a problem, get back to the list with additional info.


-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
FAX: (574)288-4373
HOME: (574)289-5227
EMAIL: [email protected]
WWW (personal): http://www.nd.edu/~rwilliam
WWW (department): http://www.nd.edu/~soc
*
* 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