This macro stores the ranks of the data for each level of a grouping variable. By default, the smallest value in each group is assigned a 1, the 2nd smallest value in each group is assigned a 2, and so on. Ties are assigned the average rank.

This macro stores the ranks of the data for each level of a grouping variable. By default, the smallest value in each group is assigned a 1, the 2nd smallest value in each group is assigned a 2, and so on. Ties are assigned the average rank.

Download the Macro

Be sure that Minitab knows where to find your downloaded macro. Choose File > Options > General. Under Macro location browse to the location where you save macro files.

Important

If you use an older web browser, when you click the Download button, the file may open in Quicktime, which shares the .mac file extension with Minitab macros. To save the macro, right-click the Download button and choose Save target as.

Required Inputs

  • A column of numeric values
  • A column of corresponding grouping values.
  • An empty column to store the results

Optional Inputs

REVERSE
Use to store the reverse ranks (largest = 1, second largest = 2, and so on.).

Running the Macro

Suppose your groups are in C2 and the data to be ranked is in C3 and you want to store the ranks in C4. To run the macro, choose View > Command Line/History and type:

%BYRANK C2 C3 C4

Click Run.