| |
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: how does insheet determine datatypes?
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/