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

RE: st: RE: destringing values led to Stata recoding them as missing


From   "Wallace, John" <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   RE: st: RE: destringing values led to Stata recoding them as missing
Date   Fri, 27 Aug 2004 16:45:22 -0700

Hi Suzy,
Stata only recognizes variables as being either string or numeric - even if
the data look like numbers, they could be stored as strings.  Stata tries to
decide on how to store the data as it is imported;  from what I can tell it
looks at the first record in each variable (column) as it comes in and
stores it as numeric only if all the characters are numbers.  If a later
record in the variable has non-numeric characters in it, Stata will store it
as . (missing) and it should alert you that variable x has non-numeric
characters.  If you lucked out and the first record has non-numeric
characters in it, Stata will store the values in the entire variable as
strings.  It seems likely that this is what happened in your case - in other
words what you see as 1234 is actually stored as "1234".

When you destring that quantity you get 1234, as expected.  However when
Stata comes across "V234", that doesn't resolve to a number after
destringing, so it puts a . (missing) value in that place, exactly as it
would have done on importing.




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index