| |
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: how does insheet determine datatypes?
Insheet is indeed very efficient in finding the correct format of raw data.
The only situation giving problems for me is reading raw files with a
unique 10 digit person identifier. Handling this large integer as a key
in merge gives problems. To force the variable to a string either create
a dictionary or use the mechanism described by Bill Gould, namely to
have just one record where the column contains letters.
I edit the raw file manually by adding a record at the top after
variable names or (better) use stata to add that line:
cpr v1 v2 v3
0xx1201956 1 2 2 // this record will force the first
variable to string
0101201956 1 2 2
1101201954 1 2 1
etc .... rest of records
and then read as :
insheet using myfile
drop in 1
....and I have the cpr variable as a string without the "fake" record
Jens Lauritsen, MD, PhD
University of Southern Denmark
Odense University Hospital, Denmark
*
* 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/