Dear community,

I loaded an Excel file where two columns contain more than one line (The cell includes, for example, industry classification of firms--firms can have more than one industry code. The database that I use puts each code in one line in the Excel sheet). When I import the Excel file to Stata something weird happens:

-The value of the cells under that column appears in one line and the carriage returns seem to appear as spaces at the end of the string (when I -br- the data). I tried using the dataex to show you the data. But, dataex does not capture the problem. So, here is how I see the data:

Array
The first line is fine. The second line is supposed to contain these industry codes:
524210
524126
524128
524130

When I count the number of characters for this line, Stata tells me that it has 27 characters (6*4 +3)

But, then I -ltrim- (or rtrim) the variable, there seems to be no space at the end. When I try to list and see the value, I see this:

Array

Here it seems that carriage returns appear as spaces between the 6-digit codes. But, when I try to split this based on spaces, nothing is split.

So, the issue is that the spaces (produced through space carriages in Excel) seem to be at the end of the string when I browse the data. When I list the data, they seem to be between 6-digit codes.

What is going on here? How can I split these industry codes into different cells or put a punctuation mark between them?

Thanks,
Navid