Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: missing values nightmare?


From   "Diego Bassani" <[email protected]>
To   <[email protected]>
Subject   st: missing values nightmare?
Date   Tue, 3 Oct 2006 18:46:48 -0400

I had no clue this could happen and I am horrified it does...

When I write a simple line in stata 9.0

recode x 0=1 if z>2

I get all values of x that equal 0 recoded into 1 when z equals . or .a or .b

this means Stata understands missing values as large numbers... 

I have tried a couple of times and it consistently recodes considering missing values as larger than life numbers 

see the example of the dataset

var1	var2	var3	var4
1	0	1	0
1	0	1	0
1	0	1	0
10	0	1	0
10	0	1	0
10	0	1	0
100	0	1	0
100	0	1	0
100	0	1	0
1000	0	1	0
1000	0	1	0
1000	0	1	0
.	0	1	0
.	0	1	0
.	0	1	0
.	0	1	0
.	0	1	0
.	0	1	0
.	0	1	0
.	0	1	0


after running the following line, which should recode only 9 values, what I get is the dataset below.

recode var2 0=1 if var1>1

var1	var2	var3	var4
1	0	1	0
1	0	1	0
1	0	1	0
10	1	1	0
10	1	1	0
10	1	1	0
100	1	1	0
100	1	1	0
100	1	1	0
1000	1	1	0
1000	1	1	0
1000	1	1	0
.	1	1	0
.	1	1	0
.	1	1	0
.	1	1	0
.	1	1	0
.	1	1	0
.	1	1	0
.	1	1	0

Is it possible that no one noticed this? And if yes, why did stata not fix it yet?

The way around it was tricking the system by recoding the missing values into some very small or negative value, temporarily, so we can make the transformations without the giant missing value bug playing its tricks...

I am astonished.

Diego

Diego G. Bassani, M.Sc., Ph.D. 
Epidemiologist - Post-Doctoral Fellow
Centre for Addiction and Mental Health 
Health Systems Research & Consulting Unit 
33 Russell Street, Tower - T308
Toronto, ON - M5S 2S1 
[email protected] 
http://www.camh.net/hsrcu
Phone: +01 (416) 535 8501 # 6465
Fax: +01 (416) 979 4703
  

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