Convert a dta file to csv without Stata software

前端 未结 11 2118

Is there a way to convert a dta file to a csv?

I do not have a version of Stata installed on my computer, so I cannot do something like: <

11条回答
  •  孤街浪徒
    2020-11-30 22:37

    The frankly-incredible data-analysis library for Python called Pandas has a function to read Stata files.

    After installing Pandas you can just do:

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

    Amazing!

提交回复
热议问题