Redefines a list of factors to coordinate their levels or labels (R.W. Payne).
Options
FREPRESENTATION = string token |
Whether to coordinate the factors to have the same levels, labels or (ordinal) number of levels (levels , labels , ordinals ); default leve |
---|---|
DIRECTION = string token |
How to sort the levels or labels (ascending , descending , given ); default asce |
CASE = string token |
Case to use for labels (given , lower , upper , sentence , title ); default give |
REMOVEUNUSED = string token |
Whether to remove unused levels (yes , no ); default no |
Parameters
FACTOR = factors |
Factors to be coordinated |
---|---|
NEWFACTOR = factors |
New factors, redefined to share the same levels or labels; if unset, the original FACTOR is redefined |
Description
FACLEVSTANDARDIZE
allows you to redefine a set of factors so that they have the same set of levels or labels. The original factors are listed by the FACTOR
parameter, while the NEWFACTOR
parameter saves the redefined factors. If no NEWFACTOR
is defined for one of the factors in the FACTOR
list, the original factor itself is redefined.
The FREPRESENTATION
option controls whether it is the levels or labels that must be the same for the redefined factors. Alternatively, if you set FREPRESENTATION=ordinals
, the levels and labels are ignored and the factors are simply redefined so that their numbers of levels become identical. By default, FREPRESENTATION=levels
.
The DIRECTION
option controls whether the set of levels or labels for the redefined factors is sorted into ascending or descending order, or whether they are kept in the order in which they are met in the FACTOR
list.
The CASE
option enables you to change the case of letters in the labels. The default setting, given
, leaves the labels unchanged. So, for example, 'Control'
and 'control'
would be treated as two different labels. The available settings are:
given |
leaves the case of each letter exactly as given in the string; |
---|---|
upper |
changes all letters to upper case (or capitals); |
lower |
changes all letters to lower case; |
sentence |
puts the first character in the text (if a letter) into upper case, then uses upper case only at the start of each new sentence; |
title |
begins each new word with a capital letter, but otherwise uses lower case. |
The REMOVEUNUSED
option allows you to remove any levels that are defined for a factor, but are not present in its values.
Options: FREPRESENTATION
, DIRECTION
, CASE
, REMOVEUNUSED
.
Parameters: FACTOR
, NEWFACTOR
.
Method
FACLEVSTANDARDIZE
uses the SETCALCULATE
directive to form the combined set of levels or labels, SORT
(if necessary) to sort them, and EQUATE
to transfer the values from the original to the redefined factors (matching their levels or labels as required). The cases of the labels are changed using TXCONSTRUCT
.
Action with RESTRICT
Any restrictions are ignored.
See also
Procedures: FACAMEND
, FACSORT
. FACUNIQUE
, FDISTINCTFACTORS
.
Commands for: Calculations and manipulation.
Example
CAPTION 'FACLEVSTANDARDIZE example'; STYLE=meta FACTOR [LEVELS=!(14,15,16,17); VALUES=14,15,16,17] f1 FACTOR [LEVELS=!(12,13,14); VALUES=12,13,14] f2 FACTOR [LEVELS=!(11,13,15,17); VALUES=11,13,15,17] f3 FACLEVSTANDARDIZE f1,f2,f3; NEWFACTOR=g1,g2,g3 PRINT (f1,f2,f3,g1,g2,g3)2; FREPRESENTATION=6(levels,ordinals);\ FIELD=5; DECIMALS=0 FACLEVSTANDARDIZE [DIRECTION=given] f1,f2,f3; NEWFACTOR=g1,g2,g3 PRINT (f1,f2,f3,g1,g2,g3)2; FREPRESENTATION=6(levels,ordinals);\ FIELD=5; DECIMALS=0 FACTOR [LABELS=!t(d,e,f,g); VALUES=1...4] f1 FACTOR [LABELS=!t(b,c,d); VALUES=1...3] f2 FACTOR [LABELS=!t(a,c,e,g); VALUES=1...4] f3 FACLEVSTANDARDIZE [FREPRESENTATION=labels] f1,f2,f3; NEWFACTOR=g1,g2,g3 PRINT (f1,f2,f3,g1,g2,g3)2; FREPRESENTATION=6(labels,levels);\ FIELD=5 FACLEVSTANDARDIZE [FREPRESENTATION=labels; DIRECTION=given]\ f1,f2,f3; NEWFACTOR=g1,g2,g3 PRINT (f1,f2,f3,g1,g2,g3)2; FREPRESENTATION=6(labels,levels);\ FIELD=5