Permutes the levels and labels of a factor (J.T.N.M. Thissen).
||Order into which to sort the levels or labels of
||Factor whose levels or labels are to be permuted|
||To specify the new order of the factor levels or labels|
Occasionally a clear presentation of results requires permutation of factor levels. For example, describing the interaction between two qualitative factors you may want to change the order of the factor levels to clarify the interaction structure.
The factor whose levels are to be permuted must be specified using the
FACTOR parameter. The new order of the factor levels can be specified using the
NEWLEVELS parameter, either by way of the numerical levels (in a variate) or by the labels (in a text).
NEWLEVELS parameter is not specified and the factor has labels, the levels are sorted so that these are in alphabetic order. If
NEWLEVELS is not set and there are no labels, the levels of the factor are put into numerical order. The
DIRECTION option determines whether the sort is into ascending or descending order; by default
The procedure uses the
SORT directive and a new factor declaration to change the order of the factor levels or labels.
Restrictions are not allowed.
Commands for: Calculations and manipulation.
CAPTION 'FACAMEND example'; STYLE=meta VARIATE [VALUES= 1...20] Y FACTOR [LEVELS= !( 8, 12, 11, 10, 9);\ LABELS= !T( August, December, November, October, September);\ VALUES= 4( 8...12)] Month1, Month2 TABULATE [CLASSIFICATION= Month1; PRINT= totals] Y FACAMEND Month1; NEWLEVELS=!T(August, September, October, November, December) PRINT 3(Month1,Month2); DECIMALS=0; FREPRESENTATION=ordinals,levels,labels TABULATE [CLASSIFICATION= Month1; PRINT= totals] Y FACAMEND MontH2; NEWLEVELS= !(8...12) TABULATE [CLASSIFICATION= Month2; PRINT= totals] Y FACAMEND Month2 TABULATE [CLASSIFICATION= Month2; PRINT= totals] Y