Edit Routings
Summary | This article explains the idea of edit routings which is essentially the concept of using logic to reshape or recode data after it has been collected. |
Applies to | AskiaDesign |
Written for | Scripters and Data Processors |
Keywords | Routing; logic; Conditions; Script; Design; Edits; Recode; Clear; Tidy; |
What are Edit Routings? You might know these by another name: cleaning scripts or recode logic. The idea is simple. Once you have collected data, you can change this data or use it to create new data using logical conditions.
Example 1
Download test files here.
Imagine we have a multi-coded question which forces respondents to pick five candidates in order. However, after we have collected the data we realise that one of the candidates in the code-list is ineligible. We’d like to remove the responses given for this candidate and also trim all respondents’ answers so they have chosen only three candidates.
We open our original QES file (ex1_BEFORE.qes) and write the routing logic in the normal way. The only difference is that we must check the ‘Edits’ option for the routing to be available in the edits routing menu in AskiaTools.
- ??Candidate??-5 : removes the votes given to the 5th candidate (the ineligible one) from respondent’s answers.
- ??Candidate??-??Candidate??[4] : removes the votes given to the 4th selected candidate from respondent’s answers.
Now we save the file and open it up in AskiaTools. Run the edits as follows:
You’ll note there are two other options:
- On all interviews – This option runs all the edits in the QES file together. There is no option to select a sub-set of edits to run. It takes slightly longer.
- On N first interviews – This option runs all the edits in the QES file together. However it gives you the option to run them on the firs N records found in your file i.e. records 1 – 10 or 1 – 50 but not records 33 – 78 for instance. There are other was to achieve this e.g. find/set a marker for these records using edits or existing logic and incorporate this into your final edits condition.
Now once we have run the edits we are left with ex1_AFTER.qes. Let’s compare the difference in the data:
Example 2
Download test files here.
Here we have two multi-coded variables: q12f1conv & q12f2conv then a loop with two iterations after this called: q12eLoop. Each q12f relates to one iteration of the loop. In order to tidy things up:
- We need to edit these two questions into the loop which has two iterations.
- Furthermore, the original code-frames have unnecessary dummy codes (codes 6 to 96). In our final q12f, we want these dummy codes to be removed so we have a much more concise code-frame.
You can see what I’m referring to in the example .qes files: ex2_BEFORE.qes and ex2_AFTER.qes.
In ex2_AFTER.qes, the edits have been run:
You can run some spot checks to see that the data from the original code-frames have been put in the correct positions in the new code-frame for q12f. You can now remove q12f1conv & q12f2conv to leave a more concise QES file than we began with.
Brief note on clearing / cleaning data
Download test files here.
You can use edit routings to remove data from questions as well. For example, below you can see the values you would set for the different question types and the result on the data.