Statalist The Stata Listserver


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

Re: st: ONE STATA QUESTION ON READING DATA


From   "Ni Frank" <frankflying03@hotmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: ONE STATA QUESTION ON READING DATA
Date   Mon, 19 Mar 2007 04:46:24 -0400

hi,

Thanks a lot! I have tried

infile col1-col5 using C:\statafile\grade2006.txt, clear

what I saw in the results window of STATA is as follows. And since the file is large, it can't stop, which probably means there are so many stuff not being able to read.

Is there something wrong again?
infile col1-col5 using C:\statafile\grade2006.txt, clear
'1.00000.000000.000000.000000' cannot be read as a number for col1[117]
'351.000001.00000' cannot be read as a number for col1[120]
'84147149865196.12309.60336.63218.34402.96' cannot be read as a number for col1

[716]
'.000000.0000001.00000.000000' cannot be read as a number for col1[864]
'351.000001.00000' cannot be read as a number for col1[867]

.......
.......












From: "Svend Juul" <SJ@SOCI.AU.DK>
Reply-To: statalist@hsphsun2.harvard.edu
To: <statalist@hsphsun2.harvard.edu>
Subject: Re: st: ONE STATA QUESTION ON READING DATA Date: Mon, 19 Mar 2007 09:07:11 +0100

Frank wrote:

Can anyone help me to solve this problem?
I have a (large) dataset in ASCII file. It contains
N colomn data (numerical numbers). I only want to read
part of them, for example, from 5th column to 10th
column into STATA, how to do that?

- and later, after some advice:

When I use the command
infile col1-col5 using C:\statafile\grade2006.raw, clear

why it says " file C:\statafile\grade2006.raw not found" ?
( By the way, my data is in grade2006.txt file. )
----------------------------------------------------------------

Obviously, if the filename is grade2006.txt, use that name:
infile col1-col5 using C:\statafile\grade2006.txt, clear

As to the first part of the question: I guess you have a fixed
format ASCII file like this

6526399317663163...
2033027247525752...
6363281072117388...
3660269579850137...

So column 5 to 10 in the first observation contains 393317.
If this represents three different two-digit variables which
you want to give the names v1-v3, use:

infix v1 5-6 v2 7-8 v3 9-10 using C:\statafile\grade2006.txt, clear

Hope this helps

Svend
__________________________________________

Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6
DK-8000 Aarhus C, Denmark
Phone: +45 8942 6090
Home: +45 8693 7796
Email: sj@soci.au.dk
__________________________________________

*
* 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/
_________________________________________________________________
享用世界上最大的电子邮件系统— MSN Hotmail。 http://www.hotmail.com
*
* 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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index