# \[ANN\] ReadStatTables.jl v0.2.2 is faster than all related packages for reading Stata files

**URL:** https://discourse.julialang.org/t/ann-readstattables-jl-v0-2-2-is-faster-than-all-related-packages-for-reading-stata-files/91764
**Category:** Package Announcements
**Tags:** package, announcement, statistics, data
**Created:** [December 17, 2022, 6:40am UTC](https://discourse.julialang.org/t/ann-readstattables-jl-v0-2-2-is-faster-than-all-related-packages-for-reading-stata-files/91764 "2022-12-17T06:40:45Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Norman](https://avatars.discourse-cdn.com/v4/letter/n/97f17d/32.png) [@Norman](https://discourse.julialang.org/u/Norman)
#### Post date: [December 17, 2022, 6:40am UTC](https://discourse.julialang.org/t/ann-readstattables-jl-v0-2-2-is-faster-than-all-related-packages-for-reading-stata-files/91764/1 "2022-12-17T06:40:45Z")

</div>

[ReadStatTables.jl](https://github.com/junyuan-chen/ReadStatTables.jl) is a package for reading data files from Stata, SAS and SPSS into Julia tables. Substantial improvement has been made for this package recently. Since the v0.2.0 rewrite, it no longer relies on [ReadStat.jl](https://github.com/queryverse/ReadStat.jl) for parsing the data files, but directly interacts with the C library [ReadStat](https://github.com/WizardMac/ReadStat). This allows the access to complete functionality of `ReadStat` and significant performance improvement.

With the v0.2.2 release, multithreaded reading is supported and turned on by default for Stata `.dta`, SAS `.sas7bdat` and SPSS `.sav` formats. Benchmark results [here](https://github.com/junyuan-chen/ReadStatTablesBenchmarks) show that [ReadStatTables.jl](https://github.com/junyuan-chen/ReadStatTables.jl) reads Stata `.dta` files significantly faster than all well-recognized open-source packages, including `pandas` and all other packages based on `ReadStat` (e.g., `haven`). This statement is expected to hold true for SAS and SPSS files as well but is not verified.

![](https://raw.githubusercontent.com/junyuan-chen/ReadStatTablesBenchmarks/main/results/v0.2.2/stata_10k_500.svg)

---

<div class="post-metadata">

### Author: ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)
#### Post date: [December 17, 2022, 9:26am UTC](https://discourse.julialang.org/t/ann-readstattables-jl-v0-2-2-is-faster-than-all-related-packages-for-reading-stata-files/91764/2 "2022-12-17T09:26:16Z")

</div>

How fast is Stata in comparison?

---

<div class="post-metadata">

### Author: ![Norman](https://avatars.discourse-cdn.com/v4/letter/n/97f17d/32.png) [@Norman](https://discourse.julialang.org/u/Norman)
#### Post date: [December 17, 2022, 12:43pm UTC](https://discourse.julialang.org/t/ann-readstattables-jl-v0-2-2-is-faster-than-all-related-packages-for-reading-stata-files/91764/3 "2022-12-17T12:43:24Z")

</div>

I am not entirely sure what would be the comparable way to measure that in Stata. If I directly use `timer` around the `use datafile` statement in Stata, I got elapsed time that is on the same magnitude of that measured for ReadStatTables.jl. But, if I repeatedly turn the `timer` on and off in a `forvalues` loop in a `program`, the average time is less than a quarter of what is measured in a single run. So, the open-source solutions are probably still slower than Stata, but the gap is smaller now.
