Use as Template for Replication
|Related Online Training modules|
|Template For Replication|
|Generally it is best to access online training from within Q by selecting Help > Online Training|
To automatically construct a set of variables, you:
- Construct a single variable to serve as a template and press OK.
- Right-click on the variable and select Insert Ready-Made Formula(s) > Use as Template for Replication.
- The Template Replication dialog box will appear, showing you how the variable is to be used as a template. The first column shows us the variables that will be created. Note that in the example below Q has correctly guessed the variable labels and has used the Name of the template variable as the base for constructing the new names. If the variable you have selected is not appropriate as a template, you will receive an error message.
- Press OK and a new question is created beneath the template variable. You can then delete the template variable and, in this case, delete the last three variables of the newly created question (i.e., the two “other” variables and the “don’t know” variable).
Consider two Number - Multi questions, Hours spent and Minutes spent, comparised of the following variables:
- q1a: Hours spent eating
- q1b: Hours spent watching TV
- q1c: Hours spent talking
- q2a: Minutes spent eating
- q2b: Minutes spent watching TV
- q2c: Minutes spent talking
We wish to view the total time spent doing each task - a combination of Hours spent and Minutes spent - in hourly terms. So, we construct a numeric variable that does this for the first variable in both questions. We call it "Time spent eating." Its expression is:
q1a + q2a/60
We can now use this variable as a template to construct numeric variables that accomplish the same calculation for the remaining variables in both questions. We use the Template Replication feature on the Time spent eating variable, and finally end up with a new question, with three variables:
- Time spent eating [q1a + q2a/60]
- Time spent watching TV [q1b + q2b/60]
- Time spent talking [q1c q2c/60]
Pages with syntax highlighting errors
Q Technical Reference
Q Technical Reference
Q Technical Reference > Setting Up Data > Creating New Variables