Stratified random sampling

This macro generates a stratified random sample.

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 data
  • A corresponding column of group values
  • The number of values you want to sample from each group
  • Two empty columns to store the results

Running the Macro

Suppose your data are in C1, the group indicator is in C2 and you want to sample 5 observations from each group. You want to store the samples in C5 and the group indicator in C6. To run the macro, choose View > Command Line/History and type:

%STRAT C1 C2 5 C5 C6

Click Run.