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
Related Posts with Problem with the data form a multi-line Excel cell
Calculation of Blau Index / Simpson IndexHello everyone! I am trying to analyze the degree of national and gender diversity of TMTs of germa…
Return how many variables were overwritten (because they had the same name) in a merge?If I merge two datasets and two variables in the datasets had the same name, how can I get Stata to …
Ordering Multiples variablesI am having a dataset in wide format for almost 80 years for 100 countries for about 200 variables. …
expand dataDear Stata users, I have a panel database of countries observed on a yearly basis from 2004 to 2018…
Help with selecting type of ANOVAHello statalisters, I am trying to perform an analysis on a dataset that contains information on pa…
Subscribe to:
Post Comments (Atom)
0 Response to Problem with the data form a multi-line Excel cell
Post a Comment