R. Prabhakar
> i was wondering what is the procedure that stata using in descding
> datatypes in the insheet command. does it do it based on the datatype of
> the first row of data? if so, then what does it do when the data in teh
> first row is missing?
>
-insheet- is inclined to treat variables
as numeric unless they are "obviously" string.
But one non-numeric value is enough to make
a variable "obviously" string. A single period
may, however, be interpreted as numeric, because
that indicates numeric missing.
I created this little test.dat
v1,v2,v3,v4,v5
1,.,"3","4",.
5,6,7,"8",9
10,11,12,"13",14
15,16,17,"18","toad"
and used -insheet-.
-v1- with values 1,5,10,15 is treated as numeric.
-v2- with values .,6,11,16 ditto.
No surprises so far.
-v3- with values "3",7,12,17 is also treated
as numeric. In effect, the " " are ignored.
Clearly, -insheet- looks beyond the first
data row.
Similarly, -v4- with values "4","8","13","18"
is treated as numeric. Even the " " on every
value do not make this a string variable.
In contrast, -v5- with a single non-numeric
value, the "toad" lurking at the bottom,
is treated as string. Clearly, -insheet-
can change its mind even at the last row.
This sensitivity clashes, for example, with
the habit of many spreadsheet users of
interpolating lines of text within their
data files. But treating such a variable as string is the
only way that Stata can do justice to
what you input. Stata is not in the business of
guessing what the data "should" be.
There is, I guess, a question behind your
question. The FAQs at
http://www.stata.com/support/faqs/data/#read
may help. Start with
http://www.stata.com/support/faqs/data/allstring.html
Nick
[email protected]
*
* 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/