Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: Skipping Lines When Reading Raw Data


From   Friedrich Huebler <huebler@rocketmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Re: Skipping Lines When Reading Raw Data
Date   Fri, 30 Sep 2005 08:17:45 -0700 (PDT)

Alan,

Assuming the 16 lines are imported as 16 additional observations you
can drop them after -infix- like this:

. count
. drop if _n > r(N)-16

Friedrich Huebler

--- Alan Neustadtl <alan.neustadtl@gmail.com> wrote:
> I am reading in a large number of raw data files that contain
> header
> information as well as non-data information at the end of the file.
> 
> The first seven lines always contain header info and I can skip
> over this using the following code:  "infix 8 firstlineoffile".
> 
> When the data end, there are sixteen lines with non-data
> information. 
> If there are 92 observations the sixteen lines begin on the 100th
> line
> (7+92=99=header+data).  If there are 126 observations (7+126=133)
> the sixteen lines begin on line 134.
> 
> Any ideas about how to either read these data w/o the last sixteen
> line or how to drop the observations after reading in all the data?
> I do not know the number of observations beforehand.
> 
> TIA,
> Alan


		
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.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