Object Reference : Object View and Procedure Reference : Group
  
 
reorder
Reorder the members of the group.
Syntax
group_name.reorder(options) arg
The members of the group will be re-ordered based on the ordering given by arg. arg is either a list of variable names denoting the new ordering, or a keyword specifying a metric to use to compute the re-ordering:
 
@first
Order the group members based upon their first value (ignoring NAs).
@firstna
Order the group members based upon their first value (treating NAs as a value).
@last
Order the group members based upon their last value (ignoring NAs).
@lastna
Order the group members based upon their last value (treating NAs as a value).
@max
Order the group members based upon their maximum value.
@mean
Order the group members based upon their mean.
@median
Order the group members based upon their median value.
@min
Order the group members based upon their minimum value.
@obs
Order the group members based upon the number of non-NA observations.
@rand
Randomize the ordering.
@reverse
Reverse the current ordering.
Options
 
r
Reverse the sort order.
Examples
group g1 v w x y z
g1.reorder x y z w v
creates a group containing V W X Y Z, then reorders the group members to X Y Z W V.
g1.reorder @mean
reorders the group members based upon their mean (highest to lowest).
g1.reorder(r) @mean
reorders the group members based upon their mean (lowest to highest).