Forms vectors with the restricted subset of a list of vectors (R.W. Payne).
||Whether to form the new vectors only when the old vectors are restricted or aways (
||Scalar set to 1 or 0 according to whether or not the old vectors are found to be restricted|
||Variate with each unit set to 1 or 0 according to whether or not that unit is restricted in any of the
||Whether to reform the levels (and labels) of factors to exclude those that do not occur in the restricted subset (
||List of vectors, one or more of which may be restricted|
||New vectors which will contain only the unrestricted units of the old vectors|
RESTRICT directive can be used in Genstat to associate a “restriction” with a vector, so that subsequent directives operate on only a subset of its units (see the Guide to the Genstat Command Language, Part 1, Section 4.4.1). This is very convenient, as the full set of data is still available and can be reinstated by cancelling the restriction. However, there are also occasions when it may be preferable to form a vector that contains only the restricted units. This is particularly true within procedures that may themselves need to apply restrictions, in addition to those already applied to their input vectors.
OLDVECTOR parameter specifies the list of possibly-restricted vectors, and the
NEWVECTOR parameter specifies a list of vectors to store the values from their unrestricted units.
FRESTRICTEDSET first checks whether any of the old vectors is restricted and, if more than one is restricted, it gives a fault if the restrictions are not the same. The unrestricted set is defined to contain the units that are not restricted on any of the vectors. The
RESTRICTED option can be set to a scalar which will be set to one or zero according to whether or not any
OLDVECTOR was restricted, and the
VRESTRICTED option can save a variate containing 0 in the restricted units and 1 in the unrestricted units. The
METHOD option controls whether the new vectors are formed irrespective of whether or not the old vectors are restricted, or only if they are restricted. If the restricted subset excludes some of the levels of a factor, a new reduced set of levels (and labels) can be requested by setting option
FRESTRICTEDSET first uses directives such as
GROUPS to check whether any vector is restricted, whether the restrictions are compatible and to form a logical variable to indicate which units are not excluded by the restriction. It then calls
SUBSET to form the new vectors.
Restrictions on the old vectors are used to determine which of their units should be copied to the new vectors.
CAPTION 'FRESTRICTEDSET example'; STYLE=meta VARIATE [VALUES=1...10] X TEXT [VALUES=a,b,c,d,e,f,g,h,i,j] T FACTOR [LEVELS=2; VALUES=5(1,2)] F PRINT X,F,T; FIELD=12; DECIMALS=0 RESTRICT F,T; X2 FRESTRICTEDSET X,F,T; NEWVECTORS=X2,F2,T2 PRINT X2,F2,T2; FIELD=12; DECIMALS=0