Another option if you can't get an ORDER=Data to work is to assign a format that changes the order and use Order=Formatted
proc format;
value $mysex
'Male'=' Male'
'Female'='Female'
;
run;
proc ttest data=sashelp.heart alpha=0.05 order=Formatted;
class sex;
format sex $mysex.;
var weight;
run;
A side effect of most of the ODS output is that the space in front of the M that makes " M" come before "F" alphabetically is that the space is justified out of appearance.
Since T-test class variables should only have two levels it usually isn't that hard to come up with a format quickly.
It may be of interest that you can create the two groups for Ttest from a continuous or multivalued categorical variable by using a format.
proc format;
value tage
low-14='14 and younger'
15-high= 'Over 14';
run;
proc ttest data=sashelp.class alpha=0.05 order=Formatted;
class age;
format age tage.;
var weight;
run;
This can be very useful if you need a "this value" compared to "all the other values" of a category and pretty easy to code
proc format;
value oage
14='14'
other= 'Not 14';
run;
proc ttest data=sashelp.class alpha=0.05 order=Formatted;
class age;
format age oage.;
var weight;
run;
... View more