Sunday, December 28, 2014

Convert .dta file to .csv file

.dta is stata data file format, often you want to see the content with other more known tools like google spreadsheet or excel or any other open data format and you need to convert the file to csv format. Follow below steps to quick easy conversion.

Download python pandas if you already don't have it installed.


pip install pandas

Navigate to the folder where you have stored .dta file and follow below set of instruction to get csv out of it -

>>> import pandas as pd
>>> data = pd.io.stata.read_stata('sample.dta')
>>> data.to_csv('changed_to_csv.csv')

And you will get quick csv conversion of the dta file.