Store correlations and p-values into columns

This macro calculates the pairwise correlations and p-values for a group of columns and stores them into columns of the worksheet. Stat > Basic Statistics > Correlation will allow you to display the same results in the Session Window and store the correlations in a matrix. However, this macro will store them in the worksheet.

Download the Macro

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


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

  • Two or more columns of numeric data
  • Four empty columns to store the results

Running the Macro

Suppose you have numeric data stored in columns C1-C20 and you want to find the correlation and p-value between each pair of columns. You want to store the correlations and p-values in C22-C25. To run the macro, go to Edit > Command Line Editor and type:

%CORRSTOR C1-C20 C22-C25

Click Submit Commands.

By using this site you agree to the use of cookies for analytics and personalized content.  Read our policy