Jump to: navigation, search

ietestform is a Stata command used to test ODK based SurveySCTO forms before they are used in the field. SurveyCTO's server has a test feature that tests the ODK syntax of the form. This command is not meant as a substitute to that test, but a complement as it test for constraints specific to Stata and that the best practices used at DIME are followed.

This article is meant to describe use cases, work flow and the reasoning used when developing the commands. For instructions on how to use the command specifically in Stata and for a complete list of the options available, see the help files by typing help ietestform in Stata. This command is a part of the package iefieldkit, to install all the commands in this package including this command, type ssc install iefieldkit in Stata.

Intended use cases

This command is intended to be used after it is tested on SurveyCTO's server to make sure that there is no syntax errors in the form, but before it is used in the field. This command writes a report that outputs the results of several tests (the tests are described below). The report is in csv-format so it can be viewed in Excel and is raw text so it can be tracked in versioning control frameworks like GitHub.

This command has many different tests but only some of them are direct errors. The tests that are not errors are meant to highlight things that experienced ODK coders in SurvyeCTO usually looking for to spot errors. Sometimes these things are not errors, but actually the best way to code something, but make sure that you understand all cases listed in the report, and why they are potentially a bad practice.

If you are not sure why something was listed, then read the explanations of each test below. If you think that the command incorrectly catches cases in your SurveyCTO form then please report that here.


These instructions are meant to help you understand how to use the command. For technical instructions on how to implement the command in Stata see the help files by typing help ietestform in Stata.

This command is very simple to use in Stata, you only need to specify your SurveyCTO form and where on your computer you want the command to write the report.

ietestform, form("$projectfolder/questionnaire.xls") report("$outputfolder/form_report")

Explanation of tests used in this command

ietestform only outputs results form tests that identified an error or a potential bad practice. If a test does not find anything, the test is not at all mentioned in the report.

Coding Practices

This section describes tests related to best practices on how to use and how to not use the ODK programming to ensure a good work flow in the form. Note that these tests does not test if the ODK syntax is valid since this command is intended to be usedafter the form has passed SurveyCTO's ODK syntax tester. This tests that the form uses ODK programming in a way that follows best practices that avoids errors in the field and help ensure high data quality.

Required Column

Numeric Ranges

Match _begin/_end

For this reasons the command also tests that all _end fields also have a field name. This is not required in ODK.

Naming and Labeling Practices

Field Name Length

Repeat Group Field Name Length

Repeat Group Name Conflict

Stata Labels Columns

Explanation of using language as label column

Survey Sheet
Choice Sheet

Choice Lists

Value/Name Numeric

Duplicated List Codes

Duplicated List Labels

Unused Lists

Missing Labels

Labels With No Value/Name

Back to Parent

This article is part of the topic ietoolkit