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

st: RE: RE: import data


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: import data
Date   Tue, 26 Nov 2002 10:31:22 -0000

Nick Cox replied to Hans J. Baumgartner
> 
> Yes. I guess there are several ways to do this.
> Here are two.
> 
> You could just specify that you have various
> -str1- variables in the columns containing the
> semicolons and then -drop- those within Stata.
> 
> However, what I would do with your example is
> 
> . infix str whatever 1-80 using mydata.dat
> . split whatever, p(;) destring
> . renvars whatever? \ id place d1-d4
> 
> That is,
> 
> 1. read in the data as one string variable
> 
> 2. use -split- from SSC to split on the semi-colons.
> 
> 3. use -renvars- from STB-60 to clean up variable
> names.

Ben Kriechel's solution is better. 
Note that the feature he recommends 
was added to Stata 7 on 8 August 2001. 

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

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