# sortcc¶

## Purpose¶

Deprecated: Sorts a character matrix.

## Format¶

y = sortcc(x, c)
Parameters
• x (NxK matrix) – data

• c (scalar) – specifies the column of x to sort on

Returns

y (NxK matrix) – equal to x and sorted on the column c.

### Example¶

The use of character data is deprecated. You should use string arrays or dataframes.

// Create a matrix with character data
// in the first column
x = { "alpha",
"beta",
"alpha",
"alpha" };

print $x;  alpha beta alpha alpha  // sort the vector based on the characters x_s = sortcc(x, 1); print$x_s;

alpha
alpha
alpha
beta


## Remarks¶

• This function is deprecated. New code should use sortc().

• These functions will sort the rows of a matrix with respect to a specified column. That is, they will sort the elements of a column and will arrange all rows of the matrix in the same order as the sorted column.

• sortcc() assumes that the column to sort on contains character data.

• The matrix may contain both character and numeric data, but the sort column must be all of one type.

• Missing values will sort as if their value is below $$-\infty$$.

• The sort will be in ascending order.

• This function uses the Quicksort algorithm.

• If you need to obtain the matrix sorted in descending order, you can use:

rev(sortcc(x, c))