ODK Meta - Labelling issuing errors

1. What is the problem? Be very detailed.
ODKMeta-generated do-file encounters multiple code errors. See below in **3.

2. What app or server are you using and on what device and operating system? Include version numbers.
I am using Stata 14 and ODK Briefcase v1.14.1

3. What you have you tried to fix the problem?
This is a common problem, and I am aware that ODKMeta will rarely create a smooth do-file to clean your data. I am used to slightly modify the created do-file according to the characteristics of my data. However, this time, it keeps encountering error after error and I am unable to solve them.

  1. The SubmissionDate error "datetime variable SubmissionDate could not be converted using the mask MDYhms"
    I just comment this out or create my own code to convert these variables to date-format.

However, someone might have an easier solution to this?

  1. Next error is: "Unexpected values encountered: Elbo Sebuer r(459)". Since this error appears within one of the long foreachs, I do not know exactly where it is originated. Likely, it is a value label that have a space and it is not handling it properly, because it shows several locality names, all of them with two-words names separated by spaces.

Any ideas/help here? I am not an expert and these type of do-files are a bit difficult to read for me

Thanks in advance.

Hi @Francisco_Carballo!

Have you tried specifying different values for the local macros at the top of the do-file? The help file describes those macros as follows:

The do-file starts with the definitions of several local macros; these are constants that the do-file uses. For instance, local macro `datemask' is the mask of date values in the .csv files. The local macros are automatically set to default values, but they may need to be changed depending on the data.

You may also find parts of this Forum discussion helpful.

This looks like an error message from encode, which the odkmeta do-file uses for any select field whose list contains a non-integer name. The odkmeta do-file specifies option noextend to encode; noextend checks that the variable contains only values that are present in the associated value label.

Is Elbo Sebuer one of the choices in the choices sheet of your XLSForm? Is it defined in the value label? odkmeta defines value labels toward the top of the do-file. It knows to use quotes for labels with spaces, so that shouldn't be the issue.

I also wanted to draw your attention to the Stata command set trace on, which you can use to determine which command actually resulted in the error message. It can be especially useful for a do-file with a loop. In this case, it should allow you to determine which command resulted in the error message for which dataset and variable. (You should probably also set tracedepth 1, at least to start.)

I know we've discussed the filenames that the odkmeta do-file uses, something we're still working to fix. Are there other issues that you frequently encounter?

Hello @Matthew_White,

First of all, thanks a lot for the quick and complete response.

I was not aware of it. Will try it out. I am sure this can solve the problem.

It is one of the choices in a preloaded .csv document. I use this document to filter responses by regions and calculate locality codes. So, it does not appear in the value labels towards the top of the do-file. I am not sure how the behaviour of odkmeta is when you use preloaded data. Perhaps I can just paste there the choices from the .csv? In my choices sheet I do not have any choices for the preloaded data, but just a row: locality | locality | locality.

Great point, thank you!

With the information you provided, I think all my issues usually come from the preloaded data.

Best,
Francisco

odkmeta doesn't automatically support dynamic selects from pre-loaded data: it assumes that all choice lists are static. However, it's actually not hard to modify the do-file to account for a dynamic choice list: search the help file for "dynamic choice list," then follow the instructions to import a dynamic select field as a string variable.

Given how common pre-loaded data is, we should probably update odkmeta so that it automatically makes the changes to the do-file that are needed. I've created a GitHub issue for that here.

1 Like