Friedrich
That's the hardest part of the problem. In the end, I did the following in C++: I read the initial file, stacked all columns one after the other on a single line (an operation similar to switching from wide to long in stata), then I split each string variable in multiple words and I put each word in a new column. Finally, I put back the transformed file in wide form, using comma as delimiter. This file is very easy to import in Stata with insheet.
Anyway, thanks a lot for taking time to think about my problem !
All the best,
-denisa
---- Original message ----
>Date: Sat, 25 Aug 2007 11:09:27 -0400
>From: "Friedrich Huebler" <[email protected]>
>Subject: Re: st: importing LONG string variables
>To: [email protected]
>
>Denisa,
>
>Can you go back to the original data and create a properly delimited
>text file as in the example below, with the same number of fields in
>each row?
>
>Name,Name,,Address,Address,,PatClass,PatClass,PatClass
>Name,Name,Name,Address,Address,Address,PatClass,,
>
>Friedrich
>
>On 8/24/07, Mindruta, Denisa Constanta <[email protected]> wrote:
>> The delimiter between names and addresses is "tab" (well, it was "comma" in the previous message but it's easy to change it to "tab", which is less confusing) ; the delimiter among address (or names) themselves is "|". Because the number of addresses (and names) varies across rows, I will need a program to read across rows, count the number of "|" between two tabs and create as many new columns as the max number of "|" (+1) across rows. Then put everything between two "|" in one of the new columns. I guess I will have to do this in a different program/text editor, unless someone suggests a solution.
>*
>* 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/
*
* 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/