Option to export with variable/value labels from other languages

Use cases: Increasingly, for the surveys in which I’m involved, CAPI questionnaires have multiple languages: typically English as the main language and local language(s) as translations. In many of those same cases, the end user wants to export data such that variables have the variable and value labels of the non-English languages. This can be for several reasons:

  • Local survey monitoring needs non-English language.
  • Data dissemination needs to be done in both English and non-English languages.

Implementation ideas:

Add a selector on the export screen (and property in the API request) to select the language of variable and value labels.

Work-arounds:

The messy work-arounds I’ve seen are:

  • Export with English labels and hope that local survey management works somehow
  • Draft the question text in the local language, and then use variable and value label definitions from earlier efforts for adding English labels (e.g., take CSPro outputs, change variable names, revise and repeat until useable, etc.)

These are a shame since the metadata describing variables and values are contained in the Designer questionnaire in the translation file.

2 Likes

This would be a fantastic feature.

An option on the Tabular export would be to have separate *.do files for each of the languages that have labels in the survey.

I’ll again add a bump for the Add Data Export Type 'Tabular With Labels' because a language selector option in the export would work really well with exporting tabular with labels rather than values in multilingual surveys.

1 Like

Rather than curse the darkness, I decided to light a candle. While digesting turkey, I wrote a two R functions that extract information from the translation file, and create Stata .do files for applying that information to Stata data. One function, trans_var_lbls, extracts question text for variable labels, and creates a Stata .do file for applying those labels. Another function, trans_val_lbls, extracts option text and values, and creates a Stata .do file for applying them.

Here are some notes on use:

  • Download the translation file from Designer
  • Execute the R functions
  • Open Stata .dta file
  • Run Stata .do files to apply variable and value labels, respectively
  • Repeat the last two steps for each export file (since these functions each create one Stata file for all variables in all export files)
# define file folder and file
fileDir <- "C:/My/File/Folder/"
excelFile <- "translation_file.xlsx"

# take data from the Excel translation file to create a .do file named varlabels.do
trans_var_lbls(
	input_path = paste0(fileDir, excelFile), 		# where Excel file is located
	output_path = paste0(fileDir, "varlabels.do")) 	# where Stata file will be created

# take data from the Excel translation file to create a .do file named val_labels.do
trans_val_lbls(
	input_path = paste0(fileDir, excelFile), 		# where Excel file is located
	output_path = paste0(fileDir, "val_labels.do"), # where Stata file will be created
	label_prefix = "kh") 							# prefix that might help user
													# distinguish between multiple languages
													# (eg, en, fr, kh, etc.)

Here are the functions in maturing repository. If issues are found, please post them on the repository here. Meanwhile, I’ll try to find time to do some work on:

  • Testing with other input files
  • Add code to check that inputs meet the program’s expectations
  • Attempt to find and use labels in the translation file if they exist (rather than default to question text)
  • Add methods for ingesting long answer sets in tabs with @@_ prefix (issue here)
2 Likes