macro randomizeit stand run resp x.1-x.m; blocking block. # resp CAN BE DROPPED FROM THE COMMAND LINE, IF IT IS BLANK # EX: randomizeit stand run x.1-x.m #Where, #stand: a column for the standard order, consecutive numbers # will be written into this column and initial values here will be over-written. #run: a blank column for the run order to be generated #resp: column with responses #x.1-x.m: columns with data, usually the levels of variables in a designed exp't #block: a column identifying how subsets of the experiment are to be blocked #Copyright © 28 November 2000 Mathews and Malnar #Rev. 1.0 for Minitab V13.2 (BEK) #Rev 1.1 for Minitab 13.3 (BEK) added blocking subcommand 02/06/01 #This macro creates a random run order which randomizes the response values. #This is acheived by creating random normal values, and the data sets are indexed, #then sorted in ascending order. A new index is created for the run order. #The blocking subcommand allows the user to randomize the values within blocks. #Mathews, Malnar & Bailey #217 Third Street, Fairport Harbor, OH 44077 #(440)350-0911 #pmathews@apk.net #This macro sould be copied into the Minitab source macros directory for #immediate use, otherwise a change directory (cd) command will be needed. #Example call: # mtb> %randomizeit c1 c2 c4 c5-c9; # subc> blocking c3. # #Copy the following line, minus the leading #, to the command line: #%randomizeit c1 c2 c4 c5-c9; # blocking c3. mcolumn stand run resp x.1-x.m block mconstant k Name run 'Run Order' #names columns for easy reference for the user name stand 'Standard Order' let k=count(x.1) #counts missing and non-missing values Set stand #index for standard order 1:k End. Random k run; #creates random normal values for randomizing Normal 0.0 1.0. If Blocking Sort stand run resp x.1-x.m block stand run resp x.1-x.m block; By block. #sorts by block Sort stand run resp x.1-x.m block stand run resp x.1-x.m block; By run. #sorts using generated random normal values Sort stand run resp x.1-x.m block stand run resp x.1-x.m block; By block. else Sort stand run resp x.1-x.m stand run resp x.1-x.m; By run. endif Set run #Creates run order 1:k end. endmacro.