[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: missing values
At 01:11 AM 9/22/2005, NEYMOTIN, FLORENCE wrote:
A couple of points:
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...
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
WWW (personal): http://www.nd.edu/~rwilliam
WWW (department): http://www.nd.edu/~soc
* For searches and help try: