Statalist The Stata Listserver


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

st: Import csv file


From   "Nuno Soares" <ns.mlists@gmail.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Import csv file
Date   Mon, 28 Aug 2006 19:05:38 +0100

Hi everyone,

I need to import some csv files that have an awkward format. The format is always the same:

Name Company1 Company2 Company3 ...
Code 0000(MV) 0001(MV) 0002(MV) ...
Currency £ £ € ...
31/12/1986 data1 data2 data3 ...
30/01/1987 dataX dataY dataZ ...
...
30/12/2005 dataW dataJ dataK ...

The number of companies is variable (ie, columns), and its width is also variable. Data1, data2, etc. are numeric.

Can you please tell me if it is possible to import to Stata the data described, in the following format:

Company  Code   Currency  Date  Data
Company1 0000(MV) £   31/12/1986 data1
Company1 0000(MV) £   30/01/1987 dataX
...
Company1 0000(MV) £   30/12/2005 dataW
Company2 0001(MV) £   31/12/1986 data2
Company2 0001(MV) £   30/01/1987 dataY
...
Company2 0001(MV) £   30/12/2005 dataJ
Company3 0002(MV) £   31/12/1986 data3
Company3 0002(MV) £   30/01/1987 dataZ
...
Company3 0002(MV) £   30/12/2005 dataK
and so on.

Some treatment on the original data can be done in Excel, but I wanted to avoid it (I have almost one hundred files that I need to import...). If any one has an idea of how to do it, I would be greatly appreciated!

Best,


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