Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: tostring can produces "." from missing numeric values?!
From
Nick Cox <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: tostring can produces "." from missing numeric values?!
Date
Fri, 31 Jan 2014 00:46:30 +0000
This goes way back.
The key point is that -string(.)- is "." and -tostring- is necessarily
consistent with that.
In turn, the key to that decision by StataCorp was, and now I guess,
to ensure that -real(string(<numeric>))- was <numeric>, i.e. that
-real()- and -string()- are, so far as possible, inverses of each
other.
It's easy enough to -replace- "." with "" and to do that in a loop.
It's true that -real("")- is . but it's hard to satisfy every possible
desideratum here.
Nick
[email protected]
On 30 January 2014 23:00, László Sándor <[email protected]> wrote:
> Hi,
>
> This is a strange situation, and seriously tripped me up in StataMP 13
> for the mac. I think people should be aware of the fact that it can
> happen with tostring (version 3.0.0 01aug2003), and perhaps even
> submit it as a bug. I see no option not to let it happen.
>
> I have no time to investigate further, maybe it only happened because
> all values for missing for a variable, but this shouldn't have
> happened anyway.
>
> Actually, this made of a string variable of blanks (missing for this
> sheet of the data) a string variable of "."s: Stata imported the
> variables as numeric first (from a delimited text file) as there was
> no value to guide it, and then when I tried to make sure I am working
> with strings so I can append the sheets to a larger data file, I got
> the back the dots.. Never missing. Very confusing.
>
> I am happy to learn how I could prevent this from happening. It is
> cumbersome to count which columns should be strings for the
> -stringcol- option of -import delimited-.
>
> Thanks,
>
> Laszlo
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/faqs/resources/statalist-faq/
> * http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/