Odkmeta: “column header type not found”

@Amanda_Berman, what is the exact Stata command that you're running for odkmeta? That could help us troubleshoot the issue.

odkmeta can issue this error message if the format of the survey file differs from what odkmeta expects. For example, the survey sheet of the XLSForm must be exported to its own CSV file, which must be comma-separated, not semicolon-separated. Could that be the issue here?

Hi Matthew,

The command is exactly as in the do file, with relax (999) on the end. I have the survey saved as CSV (saved the active sheet of the XLS file as CSV). I can upload the survey and choices XLS and CSV forms. I can't upload the data since it's sensitive.survey.csv (10.8 KB)
choices.csv (71.6 KB)

1 Like

@Amanda_Berman, it looks like survey.csv and choices.csv are encoded as Unicode (specifically UTF-8).

Stata 14+ supports Unicode. However, odkmeta was written to be compatible with Stata 11, and it does not currently support Unicode. We may add Unicode support in the future, but for now, I recommend exporting your CSV files as ASCII instead.

From a first glance, it looks like the one character in your XLSForm to watch out for is , the right single quote, which doesn't appear in all eight-bit extended ASCII encodings. As long as that character only appears in labels, the simplest solution is probably just to replace it with the straight single quote ' before exporting. The presence of the right single quote may be why the CSV was exported as Unicode in the first place.

I'll create a GitHub issue noting that we should consider adding Unicode support to odkmeta or at least better documentation.

1 Like

Awesome man, Keep this sprit.

Ok thanks, will try this!

1 Like

Hi, hope your are doing well,
any development so far as far as unicode(UTF-8) is concerned

HillaryM

We haven't added Unicode support to odkmeta yet, but it continues to be a feature we want to implement. Unicode support is a recent addition to Stata, having been introduced in Stata 14. In comparison, the current version of odkmeta is intended to be backward compatible up to Stata 11.

I think our next step for odkmeta will be to bump the required version to Stata 13 (two versions behind the latest version). That'll allow us to modernize parts of the do-file, for example, using import delimited instead of insheet. From there, I think we'll be well positioned to add Unicode support, but we're probably still a ways off from that time.

1 Like

Hi,
well then, is there any advice on how to go about this error
column header type not found
invalid type() suboption
invalid survey() option

thank you
Hillary

When you export the survey sheet of the form as .csv, I would check whether it contains non-ASCII characters. If it does, and those characters are in the label column, you should be able to resolve the error by replacing the characters with ASCII characters of your choice. For example, in the case above, had to be replaced with '. The best approach is likely to replace the characters in the XLSForm, then export to .csv again, rather than editing the exported survey .csv file.

Are you able to upload your form here? That'd be helpful in tracking down the specific issue.

great thanks,
i have managed to run it though my out put(.dta file) still has string observations, my hustle is now to edit the do file and code the strings with numeric values,

I'm glad you were able to generate and run the do-file! Are you seeing a Stata variable that is string that you expected to be numeric? If so, what was the type of the ODK field? Stata should automatically import fields like integer and decimal as numeric. The odkmeta do-file also value-labels select_one and select_multiple fields and formats date, time, and datetime fields, which makes all those types numeric in Stata.

A post was split to a new topic: Odkmeta: column header type not found. invalid type() suboption. invalid survey() option

choices.csv (14.6 KB) survey1.csv (1.8 KB)

These are my files, I still keep getting same error. Please help

Hi @Logonia, and welcome to the ODK forum! When you have a chance, I'd encourage you to introduce yourself here. Doing so helps build community!

Your CSV files are saved as Unicode files, which odkmeta currently does not support. However, I don't actually see any non-ASCII characters in your files. If you save your files again as ASCII files (not Unicode/UTF-8), you should be able to use them with odkmeta. For example, in my version of Excel, after clicking "Save As", I choose the file format "Comma Separated Values (.csv)" instead of "CSV UTF-8 (Comma delimited) (.csv)".

Hope this helps!

3 Likes

Dear Matthew,
I have same issue but I tried to save my files as ASCII filkes (seechoices.csv (8.8 KB) survey.csv (86.2 KB).
I received this message when I executed odkmeta command.
invalid name attribute 'group_ smis'
invalid name() suboption
invalid survey() option
please, how I can proceed
thanks
Jonas

Hi @Jonas, and welcome to the ODK forum! When you have a chance, I'd encourage you to introduce yourself here. Doing so helps build community!

survey.csv contains a group whose name is group_ smis (with a space). However, spaces aren't allowed in field names. Have you been able to use this XLSForm successfully?

The name of that group seems to be the cause of this error message. However, I also see non-ASCII characters in the CSV files. For example, the label of field note2 contains the text "Centre National de SpÇcialisation sur le maãs (CNS-Maãs)", but Ç and ã are not ASCII characters.

Hope that helps!

Dear @Matthew_White and fellow ODK Users,

Thanks for the very good work you're doing here. I have been using ODK for some time, but only started using stata not so long ago and perhaps this is why I keep experiencing difficulties trying to import odk data into stata using metadata (which I think is a great tool to simplify labeling of variables). I exported my data using briefcase and have also created separate survey and choices sheets. I then created a dofile and named it import.do and used the stata command window to run the syntax in the help file, but i keep getting an error. I have tried different valiations of the syntax but still not success. I should mention that I did not typed anything in the dofile itself (again, am not exactly sure what to do with/in the dofile). I am attaching my files and request a step by step guide on how this can be achieved. I read the help file over and over again, but still can't get it done. Thanks in advance
choices.csv (1.6 KB)

studentsatisdata.csv (35.8 KB) survey.csv (4.7 KB)

hi @Musinguzi_Polycarp,

when I look your survey.csv file I notice that there's a space before "name".
Could that be the problem?

could you remove the space after "type," and try again?

2 Likes

Sure thanks @aurdipas. I removed the space and everything works just fine. I can't believe that this thing kept me awake all night trying to figure out what was amiss. Am grateful to ODK forum and all the amazing people here for always providing solutions to my challenges :clap: :clap: :clap:

1 Like

This has been driving me mad all day. I have tried and tried to save the csv file but continue to get the error. I have now solved it. The issue was my computers formatting for Europe which saved the csv file with . or ; It MUST be ,

Change your region setting and it should work.