<< Click to Display Table of Contents >> Navigation: Reference > Commands > SELECT |
The format of the SELECT command is one of the following:
SELECT WR weight,
SELECT WQ weight,
SELECT BUFFER buffer,
SELECT STUB variable,
SELECT BANNER variable,
SELECT LEVEL n,
The SELECT command is non-executable. SELECT WR and WQ are used to tell CL what weighting to apply to tables and hole counts following. SELECT BUFFER is used in the Data Stage to tell CL the standard buffer from which to pick up data locations. SELECT STUB and SELECT BANNER are used to tell CL which stub and banner to use in tables. SELECT LEVEL is used to associate levels (in hierarchical data structures) with variables and tables.
Weight in a SELECT WQ or SELECT WR command may be any ivar or wvar or the constant 1. Note that other forms of arithmetic expression are not allowed here.
WR and WQ hold the names of the variables to be used for respondent and quantity weighting respectively. If "1" is selected, no variable is used and a value of 1 is assumed.
The respondent weight and the quantity weight are used when incrementing tables and hole counts; if both are specified, they are multiplied together.
Respondent weighting creates double tables; for each weighted table an unweighted copy is also incremented.
A variable selected for weighting must be defined before it is selected. Because only the name of the variable is saved, the value of the variable selected may be redefined as required, without reselecting it. Redefinitions may be conditional as required.
Selecting a variable does not alter its value.
A SELECT command takes effect at compilation time, so it is not possible to make the selection conditional in any way.
Selections are not carried over between stages of a CL script or between scripts (i.e. from IDFs and ITFs). You must SELECT the weighting variable at the beginning of each stage.
It is possible to override the setting of WQ in the T (tabulate) command by putting the expression "+weight" at the end of the command. It is not possible to override the setting of WR.
Examples of SELECT for weighting:
select wr $wt,
select wr 1,
select wq $inum,
The SELECT BUFFER command is used to tell CL which data location to use when $1-80 are referenced in the CL script. If SELECT is not used, buffer 0 ($1-80) is used; but if a buffer is set, then that buffer is used instead. For example, if buffer 4 is selected, then a reference to $61 is taken to refer to $461.
This setting is not executable. It takes effect at compilation time and cannot be made conditional. It remains in effect until a new selection is made or to the end of a Data Stage. It is possible to SELECT buffer 0 (the standard value).
The SELECT BUFFER command cannot be used with CARD CHARACTERS data.
Examples of SELECT BUFFER commands:
select buffer 3,
select buffer 200,
select buffer 0,
SELECT STUB and SELECT BANNER may be used to define the variables to be used as stubs and banners in distribution tables following, when the relevant variable is not specified. The variable selected must be either a svar or a mvar. There is no standard variable set at the start of compilation, so a command of the form:
T #table= variable * ,
will produce a one column (total only) table unless SELECT BANNER variable is used previously.
SELECT STUB and SELECT BANNER may be used as often as necessary. To set them off (so that there is no standard variable, as at the start of compilation), use:
SELECT BANNER 0,
SELECT STUB 0,
You cannot use SELECT STUB for statistics tables.
Examples of SELECT STUB and SELECT BANNER:
SELECT BANNER $break,
SELECT BANNER 0,
SELECT STUB $rows,
SELECT STUB 0,
See next section for SELECT LEVEL