Statalist The Stata Listserver


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

RE: st: how does insheet determine datatypes?


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: how does insheet determine datatypes?
Date   Fri, 5 Jan 2007 20:09:07 -0000

This is for StataCorp, as -insheet- is C code 
buried in the executable for Stata developers to 
contemplate in seclusion. But my understanding 
is that you may be better off importing as string and 
doiny your own conversions. 

Nick 
[email protected] 

Phil Schumm

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

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