The CATMOD Procedure

Ordering of Populations and Responses

By default, populations and responses are sorted in standard SAS order as follows:

  • alphabetical order for character variables

  • increasing numeric order for numeric variables

Suppose you specify the following statements:

data one;
   length A B $ 6;
   input A $ B $ wt @@;
   datalines;
low       low  23  low    medium  31 low    high  38
medium    low  40  medium medium  42 medium high  50
high      low  52  high   medium  54 high   high  61
;
proc catmod;
   weight wt;
   model A=B / oneway;
run;

The ordering of populations and responses corresponds to the alphabetical order of the levels of the character variables. You can specify the ONEWAY option to display the ordering of the variables, while the Population Profiles and Response Profiles tables display the ordering of the populations and the responses, respectively.

Population Profiles

 

Response Profiles

Sample

  B

 

Response

  A

1

high

 

1

high

2

low

 

2

low

3

medium

 

3

medium

In this example, if you want to have the levels ordered in the natural order of 'low,' 'medium,' 'high,' you can specify the ORDER=DATA option:

proc catmod order=data;
   weight wt;
   model a=b / oneway;
run;

The resulting ordering of populations and responses is as follows:

Population Profiles

 

Response Profiles

Sample

  B

 

Response

  A

1

low

 

1

low

2

medium

 

2

medium

3

high

 

3

high

You can use the ORDER=DATA option to ensure that populations and responses are ordered in a specific way. But since this also affects the definitions and the ordering of the parameters, you must exercise caution when using the _RESPONSE_ effect, the CONTRAST statement, or direct input of the design matrix.

An alternative method of ensuring that populations and responses are ordered in a specific way is to assign a format to your variables and specify the ORDER=FORMATTED option. The levels are then ordered according to their formatted values.

Another method is to replace any character variables with numeric variables and to assign formatted values such as 'yes' and 'no' to the numeric levels. Since ORDER=INTERNAL is the default ordering, PROC CATMOD orders the populations and responses according to the numeric values but displays the formatted values.