Data editing > Data-mapped variables > Using parameter substitution with data-mapped variables
 
Using parameter substitution with data-mapped variables
You can substitute variable names, response texts or array element names by using the text substitution keywords available on *include and *def statements in exactly the same way as you use them for any other purpose in Quantum. For grid axes, however, the following two new keywords are available to facilitate the substitution of variable names and response texts:
Use the var(#) keyword to substitute variable names
To use a different data-mapped variable for each column in a grid axis, you can use the var(#)= keyword. In the grid column specification, this keyword is used to specify the name of the variable to be substituted. In the grid side specifications, use var# in place of the variable name (where # can be any number in the range 1 to 9).
For example:
l gridax
n01First purchase; var(1)=q25
n01Second purchase; var(1)=q26
side
var var1;base=Total;hd=Appliances purchased;hd=-----------------
+Fridge;Freezer;Microwave oven;
+Coffee maker=$filter coffee\$;Toaster;
+None of these;Don't know/Not answered=rej
n01Fridge or Freezer;c= var1$Fridge$ .or. var1$Freezer$
If you are using a data-mapped variable array, you must follow the var(#)= keyword by a specific array element. For example:
l rates
n01Rating for Wilsons Wonderful Widgets;var(1)=wrate($wilsons\$)
n01Rating for Widgets R Us;var(1)=wrate($widgets\$)
side
var var1;=;1;2;3;4;5;Don't know/No Answer=rej
Use the resp(#) keyword to substitute response texts
Where a grid axis requires different response texts to be used for each column in the grid, then the resp(#)= keyword must be used to specify the response texts on the column specifications. The value you assign must be the full specification, including the quoting dollar characters. In the side specification, use the special response text $resp(#)$.
Below is an example of response text substitution:
l rates
n01Fridge;resp(1)=$fridge$
n01Freezer;resp(1)=$freezer$
n01Microwave oven;resp(1)=$microwave\$
n01Coffee maker;resp(1)=$filter coffee\$
n01Toaster;resp(1)=$toaster$
side
n01First purchase;c=q25$resp(1)$
n01Second purchase;c=q26$resp(1)$
n01Any purchase;c=or(q25,q26)$resp(1)$
Note The # parameter for resp(#) may only have a value of 1.
See also
Data-mapped variables