# Web-based Stata cleaning code generator

**URL:** <https://forum.getodk.org/t/web-based-stata-cleaning-code-generator/41024>\
**Category:** Showcase\
**Tags:** enketo, odk-xforms\
**Created:** [April 3, 2023, 8:39pm UTC](https://forum.getodk.org/t/web-based-stata-cleaning-code-generator/41024 "2023-04-03T20:39:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JonasWeinert](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/jonasweinert/32/20857_2.png) [@JonasWeinert](https://forum.getodk.org/u/JonasWeinert)\
**Post date:** [April 3, 2023, 8:39pm UTC](https://forum.getodk.org/t/web-based-stata-cleaning-code-generator/41024/1 "2023-04-03T20:39:06Z")

</div>

Hi All,  
I'd like to introduce a simple new WebApp: ODK -\> STATA

The app produces STATA cleaning code for your ODK generated dataset. Just upload your XLSForm to get started.

The code will

- Attach a label of user choice to the variables
- Attach the list\_name values as value labels
- Optionally: Split select\_multiple columns into dummy variables
- Label the select\_multiple dummies

Why?  
While I love ODKMETA, the wonderful stata package by IPA that does all this and more within stata, I sometimes need to produce basic cleaning code without meeting all requirements necessary when using it (eg csv files not available easily, etc.).

I would love to get your thaughts and feedback on the app!

Give it a spin: [https://odk-stata.streamlit.app/](https://odk-stata.streamlit.app/)  
Run it locally and/or contribute on GitHub: [https://github.com/JonasWeinert/ODK\_CleaningcodeGenerator](https://github.com/JonasWeinert/ODK_CleaningcodeGenerator)

Thanks!

---

<div class="post-metadata">

**Author:** ![Matthew\_White](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/matthew_white/32/1654_2.png) [@Matthew\_White](https://forum.getodk.org/u/Matthew_White)\
**Post date:** [April 3, 2023, 9:58pm UTC](https://forum.getodk.org/t/web-based-stata-cleaning-code-generator/41024/2 "2023-04-03T21:58:23Z")

</div>

Hi @JonasWeinert! I'm always excited to see activity in the ODK + Stata space. I've been busy working on ODK Central and haven't had the chance to update `odkmeta` in a long while. I like the idea of wrapping this functionality in a web app — something easier to use than running a command in Stata.

> [@JonasWeinert](#):
>
> I sometimes need to produce basic cleaning code without meeting all requirements necessary when using it (eg csv files not available easily, etc.).

Could you say more about what requirements you aren't able to meet? I think `odkmeta` mostly just needs the XLSForm (in CSV format).

Since you're using Python, I'm curious about whether you've taken a look at [https://github.com/PMA-2020/odk2stata](https://github.com/PMA-2020/odk2stata). Also, since your repository mentions R, I thought I'd point out [https://github.com/ropensci/ruODK](https://github.com/ropensci/ruODK) as well.

---

<div class="post-metadata">

**Author:** ![JonasWeinert](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/jonasweinert/32/20857_2.png) [@JonasWeinert](https://forum.getodk.org/u/JonasWeinert)\
**Post date:** [April 4, 2023, 11:52am UTC](https://forum.getodk.org/t/web-based-stata-cleaning-code-generator/41024/3 "2023-04-04T11:52:54Z")

</div>

Hi @Matthew_White!  
Thank you for the two links! As I see that they are both open source as well, I'll see how we can combine our powers:)  
The R code in the repo description is indeed a thought that might no longer be true exactly because of ruODK.

RE ODKmeta: I sometimes

- need to load the data from different file formats than csv (eg xlsx, json, etc)
- and/or don't have access to the csv files of the data
- have data that contains already split `select_multiple` fields
- needed to adjust the XLSForm label columns (to remove non ASCII characters) and change the column names.

Thank you for your input Matthew!
