DataObject.SetVarSortMode

Prototypes

void SetVarSortMode( String sVarName, int nSortMode )

Parameters

String sVarName
The name of the nominal variable whose sort mode you want to set.

int nSortMode
A predefined constant specifying the sort mode. The valid values are SORTMODE_STANDARD, SORTMODE_FREQ, SORTMODE_FORMATTED, SORTMODE_DATA, SORTMODE_FREQRAW, and SORTMODE_DATARAW. See Remarks for more information.

Remarks

This method controls how a nominal variable's values are ordered. The term sort mode is used to refer to a specific type of ordering. You can assign a sort mode to a character variable or to a nominal numeric variable. You cannot assign a sort mode to an interval variable.

The values of a nominal variable define a set of one or more categories. To specify the sort order of these categories, call the method SetVarSortMode and pass one of the following predefined constants for the nSortMode parameter:

SORTMODE_STANDARD
The categories are arranged in ascending order by their unformatted values. This is the default sort mode. Interval variables use this sort mode implicitly.

SORTMODE_FREQ
The categories are arranged according to the descending frequency count of formatted values in each category.

SORTMODE_FORMATTED
The categories are arranged in ascending order by their formatted values.

SORTMODE_DATA
The categories are arranged according to the data order of formatted values. The data order is determined by traversing the values of a variable, starting from the first observation. The first (nonmissing) value encountered is ordered first, the next unique (nonmissing) value is ordered second, and so on. Sorting the DataObject does not affect this ordering; it is based on the original order of the observations.

SORTMODE_FREQRAW
The categories are arranged according to the descending frequency count of unformatted values in each category. This sort mode is similar to SORTMODE_FREQ except that unformatted values are used.

SORTMODE_DATARAW
The categories are arranged according to the data order of unformatted values. Sorting the DataObject does not affect this ordering; it is based on the original order of the observations. This sort mode is similar to SORTMODE_DATA except that unformatted values are used.

Notes
Example
declare DataObject dobj;
x = { "Low", "Medium", "Medium", "High", "High", "High" };
dobj = DataObject.Create( "Example", "X", x );
dobj.SetVarSortMode( "X", SORTMODE_FREQ );
BarChart.Create( dobj, "X" );
See Also

DataObject.GetVarSortMode