Statalist The Stata Listserver


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

Re: st: how does insheet determine datatypes?


From   Phil Schumm <[email protected]>
To   [email protected]
Subject   Re: st: how does insheet determine datatypes?
Date   Fri, 5 Jan 2007 13:33:19 -0600

On Jan 5, 2007, at 1:14 PM, Phil Schumm wrote:
Does anyone know how -insheet- determines datatypes -- specifically, how it distinguishes between numeric and string? If I read a large file and a column that is otherwise strictly numeric has a non-numeric value toward the end, can I rely on Stata to retain that observation and set the column to string (as opposed to setting the non-numeric value to missing)? Or, can I at least rely on Stata to throw a "cannot be read as number" error that I can catch?

Actually, I just realized that the "cannot be read as number" error (as, say, raised by -infile- if you try to read a string column as numeric) isn't really an error but is just a warning, and, IIRC, doesn't leave anything around in r() to catch. Thus, while it's helpful in an interactive session, it can't be used in code.


-- Phil

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