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   "Svend Juul" <[email protected]>
To   <[email protected]>
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: [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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index