Lookup Categories Syntax

How we can lookup in categories to get the parent id of a specific id ?

The header of file categories

The categories attached in the designer

Please, explain why is this needed?

I have a question Q1 (singleSelect) where source is CategoriesClasse. After selecting a classe, I have variable Q2 where I want to get automatically the parent-id of classe selected in Q1.

Ibrahima wants a cascading question–in reverse, and with one question answered automatically by SuSo.

Here’s a simple example to articulate the requirements:

Suppose I have two questions: food (e.g., apple, water, pasta) and food classification (fruit, cereals, beverage, etc.). Suppose furthermore that there’s a neat one-to-one mapping between food and food classification. As soon as the food is answered, the food classification is known. With that in mind, there’s no need for the interviewer to record the food classification.

I see a few ways to achieve this behavior:

  1. Outside SuSo
  2. Inside SuSo

1. Outside SuSo

If food classification is not needed during the interview, then creating food classification might be a task best handled outside of Survey Solutions. The data analyst would take the exported data and the food-food classification relationship, and create a food classification variable. This approach might have the advantage of storing in data analysis/creation scripts how all constructed variables are created.

2. Inside SuSo

Here, I see two options: filter condition and variable.

2.1 Filter condition

Use filter condititions (and maybe a lookup table) to filter food classifications based on the answer to the food question.

The food classification question would still need to be answered by the interviewer, even if only one answer option is displayed.

The output data would contain a food classification column that would have variable and value labels.

2.2 Variable

Create a computed variable that returns the food classification as a function of the answer to the food question. This function might be easier/more maintainable if it relies on a lookup table.

The output data would contain a food classifcation column that would not have value labels, since computed variables store raw values (but may have variable labels).

1 Like