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

RE: st:How to input a portion of a file

From   "Nick Cox" <>
To   <>
Subject   RE: st:How to input a portion of a file
Date   Wed, 20 Feb 2008 11:35:02 -0000

I am not clear how that this will help, as the header text and the
remainder of the file will give -insheet- quite different ideas about
what variables there are. 


Friedrich Huebler

You wrote that -insheet- with subsequent deletion of unwanted data is
"sloppy". That approach might still be the easiest if all files have
the same structure and your data always appear in the same columns.

. insheet using filename, nonames
. drop if _n < 30 | _n > 129
. drop v1 - v20 v25 - v30

On Feb 18, 2008 9:26 AM, Joseph Wagner <> wrote:
> I have data I wish to input a portion of into STATA.  Data is
> on patients by a machine that measures their gait as they walk.  A
> file is output for each patient with columns representing variables
> (each about 130 lines long) but the multiple observation data doesn't
> start until line 29.  The first 28 lines are taken up with short lines
> of data describing the patient.  Unfortunately, I also need a couple
> those lines in 'header' area.  The 29th line has the variables names
> they do not line up directly with the columns of data so I figured I
> could just label the data later.  The data I need starts 30 lines down
> at column 115 and includes the next 4 columns and goes down 100 lines.
> I realize there are easier ways to do this but I have data on about
> patients (and so one file for each person) and wanted to automate this
> input (followed by successive merging of files to get my final
> I wanted to use the -infix- command but have never used this command
> before and my attempts so far have failed.  I also tried using
> with the _first(30) option and the _line(30) option but those didn't
> seem to work either.
> Here is a dictionary I attempted with just one of the variables:
> dictionary using "c:\data\gait\SBS00001_20050607_1.nrm" {
>        _line(30)
>        _column(115) r_grf_vrt_frc %5f
> }
> infile using SBS00001_20050607_1.dct
> unexpected end of file
> (5 observations read)
> The other problem is that it didn't seem to pull the data
> to that column.  I thought perhaps there was a problem with the data
> being in a fixed format but if I try -insheet- all the data imports
> the correct data lines up in the individual columns.  Of course I
> write some programming whereby I delete the unneeded variables and
> but that's kind of sloppy.
> I am using STATA ver. 8.2

*   For searches and help try:

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