Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Using infile with varying lines() per observation


From   Kevin McConeghy <[email protected]>
To   [email protected]
Subject   st: Using infile with varying lines() per observation
Date   Thu, 25 Jul 2013 16:35:19 -0500

Hello users,

It may be that STATA can't do this, I couldn't seem to find any
reference to it online or the listserve. I am trying to import data
that is in fixed format text files like so:

id col1 col2 col3
1  A     B    C
           B

2 A      B    C

3 A      B    C
           B
           B

The key is Col2 which contains essentially free text I was hoping to
import as a string. The problem is that the text varies in length per
observation and therefore each observation occupies varying numbers of
lines.

Infile allows you specify more than one line per obs through the
lines() option, but doesn't seem to let you vary this number. Is there
a user-written program for this? or some other way to address the
problem?

I think SAS can do this, but I prefer staying in STATA if I can.

Kevin
-- 
Kevin McConeghy, PharmD, BCPS
833 S Wood St, Chicago, IL 60612
College of Pharmacy, Dept. of Pharmacy Practice
University of Illinois at Chicago
(312)-413-1422, [email protected]
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index