[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: RE: import data
Hans J. Baumgartner
> is it possible with STATA to import data that is separated
> by semicolon
> AND is also in a fixed format.
> 161000;Ingolstadt ; 265; 265;
> 267; 273;
> 162000;München ; 2005; 1956;
> 1956; 1973;
> ... and so on
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
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
* For searches and help try: