Statalist


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

st: Infile errors


From   "Wallace, John" <[email protected]>
To   <[email protected]>
Subject   st: Infile errors
Date   Fri, 26 Oct 2007 14:27:10 -0700

Hello statalisters
I have a class of text files that I would like to use as a data source.
I used -type- to verify that the data is ascii.  The majority of the
file is 5 columns of tab-delimited, numerical text.  A single row
immediately before the data has single-word, tab-delimited header
information for the 5 columns, but I'm happy ignoring them if necessary.
Preceeding the header line are 23 lines of text that I don't care about.
No tab characters occur in those 23 lines however.

-insheet- is confused by the 23 lines, and imports them as string
records for variable v1 - it creates string variables v2-v5 which has
the 2nd through 5th columns of data, beginning at line 25.

-infile- would seem to be the appropriate command:

.. infile a b c d e in 25/1325 using source.txt

but this doesn't work exactly right.  It places the data from line 27
column 3 in a[1], which causes a registration shift in the dataset (and
the omission of the first 3 lines of data altogether).  Explicitly:

---begin source.txt line 25---
  0<T>  0<T>379.0<T>76.8<T> 64
  1<T>  0<T>54.0<T>14.9<T> 64
  2<T>  0<T>28.0<T>5.1<T> 64
  3<T>  0<T>24.0<T>2.9<T> 64
  4<T>  0<T>22.0<T>2.7<T> 64
  5<T>  0<T>24.0<T>2.9<T> 64
  6<T>  0<T>27.0<T>2.8<T> 64
  7<T>  0<T>25.0<T>2.7<T> 64
---end source.txt line 32---

....is imported as
     |    a     b    c    d   e |
     |--------------------------|
  1. |   28   5.1   64    3   0 |
  2. |   24   2.9   64    4   0 |
  3. |   22   2.7   64    5   0 |
  4. |   24   2.9   64    6   0 |
  5. |   27   2.8   64    7   0 |

Is there another way?  Infile with a dictionary seems like the next
step(?), but I'd like to know why specifying the record range with "in
25/1325" didn't work.

Thanks for any help

John Wallace

------------------------------------------------------------

This transmission is intended for the sole use of the individual
and entity to whom it is addressed, and may contain information
that is privileged, confidential and exempt from disclosure under
applicable law. You are hereby notified that any use,
dissemination, distribution or duplication of this transmission by
someone other than the intended addressee or its designated agent
is strictly prohibited. If you have received this transmission in
error, please notify the sender immediately by reply to this
transmission and delete it from your computer. Thank You.
Affymetrix, Inc.

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