10-30-2015 04:23 PM
Generally I want to use "class group;" to output means for "group1, group2, ....group10" like:
however, if using just "class group;", the output is like:
group10 was not output at the bottom, but instead, it showed after group1.
How can it be coded so that group10 is at the bottom. thank you very much.
10-30-2015 04:45 PM - edited 10-30-2015 04:52 PM
This is a common issue with character variables. You have couple of options. One is the be very conscious of using Group01 instead of Group1 though that may be difficulate to use as an approach if you don't know ahead of time that you're going to need Group0001 ...
The next to create your summaries into a data set. Then use proc sort with the SORTSEQ option Numeric_collation=On
proc sort data=have sortseq=linguistic(numeric_collation='ON'); by group;run;
and then print.
I'm not sure if any of the report procedures directly support the option.
The other approach is create a variable that always sorts in the order you want and then use a custom display format to diplay the desired value. Some times the new variable is easiest to create with a custom informat:
proc format ;
"group1" = 1
"group2" = 2
"group10" = 10;
1 = "group1"
2 = "group2"
newgroup = input(group,group.);
format newgroup group.;
proc means data=want ;
class newgroup /order=unformatted;