Using MINITAB to recode the bilaterally-infected ears data

Some of you have noticed that if you can refer to specific rows within a MINITAB column, you should be able to program MINITAB to recode the bilaterally-infected cases. Here is how to do it.

I have used the fact that the first 128 rows are unilateral cases and the remaining 150 rows are in consecutive pairs for the 75 bilateral cases.

Columns C1-C5 are "id" "clear" "antibio" "age" "ear" from the original file EAR.MTP.

After running the macro, columns C11-C15 are "id2" "clear2" "antibio2" "age2" "num_ears" for the bilateral cases only. Note that in the reorganized data, "clear2" is the total number of cleared ears for the child, the original variable "ear" has been dropped, and the new variable "num_ears" is the number of ears originally infected (1 for unilateral, 2 for bilateral). Note also that the macro doesn't name the columns, they will have to be named manually, and the column names may not conflict with the names of existing columns.

The MINITAB Macro

I stored the following lines in a file BILAT.MTB in the default directory:

LET C11(K1) = C1(K2+1)
LET C12(K1) = C2(K2+1) + C2(K2)
LET C13(K1) = C3(K2+1)
LET C14(K1) = C4(K2+1)
LET C15(K1) = C5(K2+1)
LET K1 = K1 + 1
LET K2 = K2 + 2
END

Then I initialized K1 to start in Row 1, I initialized K2 to start in Row 129 (the first row of the first bilateral case), and I ran the macro 75 times.

LET K1 = 1
LET K2 = 129
EXECute 'BILAT.MTB' 75 times

NOTE: The file name must be in single quotes ( 'BILAT.MTB') in the EXECute command; I originally had double quotes there ("BILAT.MTB") but that won't work. You can write the Exec file and run it from "Other Files..." under the File menu. Unfortunately, there seems to be no way to edit the Exec file in MINITAB, you have to type it perfectly the first time. You can write it and edit it with NotePad but make sure you save it as a .MTB file.

SUGGESTION: Write the command lines for the Exec file in NotePad, make sure there are no typing errors, copy them to the clipboard, go to "Files/Other Files/Start Recording Exec" in MINITAB and paste them in there. You can even avoid typing altogether if you copy the lines from this web page and paste them into MINITAB.

Back to Statistics 2MA3
Last modified 1998-01-22