Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 72787

Exporting numbers starting with zero from Excel into Stata

$
0
0
Hi,

I have an Excel file with a column that contains 10-digit codes (such as 0000324573) which start with zeros (sometimes 2, leaving 8 digit for digits 1 to 9; sometimes 4, leaving 6 digit for digits 1 to 9). The same column contains cells with strings. When I export this into Stata, it gets exported as string (in red font). However, the first zeros at the begging of that code are dropped.

I looked at my Excel file and realized that the format in Excel is not text; it is "custom with 0000000000". When I try changing the format to text in Excel, the zeros disappear.

How can I export this column to Stata while maintaining the zeros at the beginning?

I can add a character at the beginning or end of the codes in Excel and export the column into Stata and then remove the character. But, I wonder if there is any faster and more straight forward way to avoid possible mistakes.

Thanks,
Navid

Viewing all articles
Browse latest Browse all 72787

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>