Rebasing a Pick One Question
This page describes how to rebase data automatically using a QScript. If you are just looking to rebase a single question it is easier to do so directly on the table - see Hiding and Removing Categories (Missing Values).
This removes the 'Don't know' category from a Pick One question and sets it as missing (i.e., so that the table is automatically rebased when the question is used).
This example can be run in C:\Program Files\Q\Examples\Phone.sav (this may be located on a different place on your computer depending upon how Q was installed).
var age = project.dataFiles.getQuestionByName('Age'); var dk_value = age.valueAttributes.getSourceValueByLabel("Don't know"); age.valueAttributes.setIsMissingData(dk_value, true);
The second line of this code works out what value has been assigned to 'Don't know' in the data file.
- Next worked example.
- QScript for an explanation of how to run this code.
- QScript Examples Library for other examples.
- QScript Reference for technical information.