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

Re: st: Re: Skipping Lines When Reading Raw Data


From   n j cox <n.j.cox@durham.ac.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Re: Skipping Lines When Reading Raw Data
Date   Fri, 30 Sep 2005 16:42:21 +0100

Alternatively,

drop in -16/l

where note that "l" is the initial letter of _l_ast, not
the numeral "1".

Nick
n.j.cox@durham.ac.uk

Friedrich Huebler

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

Alan Neustadtl

> 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.
*
*   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