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

Re: st: missing values


From   "NEYMOTIN, FLORENCE" <[email protected]>
To   [email protected]
Subject   Re: st: missing values
Date   Wed, 21 Sep 2005 23:11:21 -0700

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

On Thu, 22 Sep 2005 00:31:41 -0500
 Richard Williams <[email protected]> wrote:
At 11:11 PM 9/21/2005, NEYMOTIN, FLORENCE wrote:
Hi, is it normal to have a problem with recoding things to missing values based on some sort of boolean condition. I checked the condition several times, and when I write: "gen extra=0 if(condition)" then this gives me the correct values. If, however, I write: "replace mainvar=. if (condition)" then this does not work. The problem was solved by doing "replace mainvar=.a" this seems strange to me and I'm not sure why it's happening. any suggestions?
thanks,
Florence
Maybe you could show us your exact commands? Or a replicable example using the auto data or something like that? I just tried a few things and it seemed to work fine. Are you sure you are specifying the conditions correctly, e.g. you are using == instead of = ?


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