How to export to a dta file?

Dear all,

I simulate a model in Julia (think of some sort of Monte Carlo experiment) and I want to export the data generated by the model to Stata (.dta format). What is the best way to do it?

Ideally, I’d like to avoid using a CSV.

Thanks!

License: Proprietary

good luck, https://github.com/queryverse/ReadStat.jl/pull/42

I have written

but writing is not implemented. PRs welcome.

That said, I would just write CSV and read it in Stata unless your data is huge.

2 Likes

Thanks!

Yeah, I think I’ll have to use CSV but I was wondering if there is something better out there.

Look forward to use your package.

There seems to be functionality to read but not to write to .dta.

that’s why it’s a [WIP] (work in progress)

As I said, writing would need to be implemented. It is fairly straightforward, except for the need to go back and do the offsets. The README of my package contains links documenting the format.

1 Like

In the meantime, I would recommend using Rcall.jl and using the haven package maintained by tidyverse.

1 Like