From KoBo to Stata (new solution)

Hi Estefania,
It looks like on the choices tab of your xlsform, you have one or several value sets that are very long - exceeding 1600 values? If you remove this value set (or at least the 17 rows in excess of 1600) before running kobo2stata, it should run through.
Best,
Felix

2 Likes

I did what you suggested and it worked!
I would love in the future that the command could run more than 1600 options in choices, in some occasions I have worked with very long surveys, it would be fabulous.
Do you think this would be possible in the future?

Thanks again for your help!

Glad to hear it worked.
Just to be clear, kobo2stata can handle a choices tab with more than 1600 rows - it is only when a single value set in the choices tab contains more than 1600 values that the error occurs.
This 1600 values limit is not so much a limitation of kobo2stata but rather of Stata itself (to be more precise, of Stata’s “numlist” function which kobo2stata depends on). A workaround would be to depend on Stata’s “forvalues” instead, but it would require a major rewrite of kobo2stata, which I’m afraid I won’t have the time for at the moment. In any case, I will make this limitation explicit in the help file when I next update it, to make sure users know how to solve the issue where it occurs.

1 Like

oh! It is good to know. But maybe I forgot something at the moment to run the code because in my case the code I did not have single values set in the choices tab contains more than 1600 values, the maximum was 1100, so I decided to count the number that the code gives in num_list and was the same in total values set in the choices tab, the num_list gove me 1617 numbers and I the time to count the total values on the sheet in choices was the same (sum all single value sets). Maybe, Am I missing something when I run the code?

Hello,

I have Stata 13 and am unable to use the kobo2stata command (see image attachedCaptura de pantalla (493) ). Is there anything I can do to make it work?

Thanks a lot!

Hi Zara,
Unfortunately kobo2stata will only run on Stata 14 or newer, as it relies on some core Stata functions that were only introduced in that version. FYI some discussion around this here: Introducing kobo2stata (new on SSC)
Best,
Felix

2 Likes

Hi Felix,

Thank you the information. Is there any other way I could pull the data from Kobo to Stata? I tried using ODK Briefcase, downloading csv files, but once converted to a dta file, it looks quite messy and would need a lot work to make it clearer…

Thanks in advance!

Hi @zaravalentinova
If you don’t have version 14 you may have to go through the long route of getting the data into SPSS first then converting it into Stata

Regards,
Stephane

1 Like

Thanks, Stephane. I had tried that but it doesn’t seem to work either…

Thanks anyways,

Best,

Could you detail your steps and the screenshots of the challenges you are seeing.

1 Like

Hello Felix,
I tried your package. I have a little issue. “invalid numlist has too many elements”. That is what is coming out. How can i solve this issue?

Hi Abikath,
please see the discussion above in this same thread on a similar issue:

Hope this helps,
Felix

1 Like

Thank you for your quick response. I deleted the row but the problem is still displaying. This is what is displaying:

Reading choices tab of XLSForm…
Reading survey tab of XLSForm…
invalid numlist has too many elements
r(123);

Does the survey tab of your xlsform have more than 1600 rows then?

Hello Felix,
I have been already helped using another tool.
Thanks

Hi @abikath
Do you want to share your solution?

Stephane

1 Like

Hi,
I don’t really have an idea of what he did. I just received my data already in stata. He said it will be difficult to explain without showing as he is not here actually. But what i suspect is that he export first in spss and then from spss to stata.

I faced this issue recently also. I have more than 2000 rows in choices sheet. And there are more than 600 items for one list_name.

I have replaced "foreach var in numlist 1/count’"with"forvalues var = 1/count'" in 3 places to solve this issue. Now it works without numlist error.

You can download fixed ado-file by the link

It would be nice if you could check it and make fixed version available through “ssc install”.

Hello Felix, how can you add reference files you added as attachments to the list of choices, to run on the kobo2stata

Hi Ahmed Salim, thanks for using kobo2stata. Unfortunately, the command currently does not support reference files attached to the primary XLSForm via „select_*_from_file“. As a workaround, you could copy and paste the content of your reference file into the choices sheet of your XLSForm, which kobo2stata should be able to pick up. But I realize this may not be a convenient solution if you are working with a large number of reference files…

1 Like