# GROUP.MAC # # Groups a data set. Modified version of c:\mtbwin\macros\group.mac. # # Macro is for MINITAB for Windows, release 10 and above # Written by: Neil A. Weiss # Date: 10/18/97 # # Revision history: # 10/20/97: Added title for output. # 10/21/97: Suppressed titles in Session-window output. # 04/02/98: Changed E to V to avoid conflict with Release 12 use # for Euler's constant. # 04/04/00: Revised to account for changes in Release 13 for what is # acceptable syntax in Minitab macros. MACRO GROUP C # C CONTAINS THE DATA TO BE GROUPED. MCOLUMN C D M LC UC F P V G H MCONSTANT w k u xmax i n a b l ans NOTITLES # SUPPRESSES TITLES IN SESSION-WINDOW OUTPUT. BRIEF 2 NOTE NOTE NOTE This macro obtains a grouped-data table using equal-width classes of NOTE your choice. To specify the class intervals, you must enter exactly one NOTE of the following three: NOTE NOTE 1. The first class midpoint and the class width. NOTE NOTE 2. The lower and upper cutpoints of the first class. NOTE NOTE 3. The lower cutpoint of the first class and the class width. NOTE NOTE NOTE Enter your choice (1, 2, or 3). NOTE BRIEF 0 SET D; FILE "TERMINAL"; NOBS 1. COPY D ans BRIEF 2 NOTE NOTE IF ans=1 NOTE Enter the first class midpoint and the class width. NOTE BRIEF 0 SET D; FILE "TERMINAL"; NOBS 2. LET M(1)=D(1) LET w=D(2) GOTO 2 ELSEIF ans=2 NOTE Enter the lower and upper cutpoints of the first class. NOTE BRIEF 0 SET D; FILE "TERMINAL"; NOBS 2. LET M(1)=MEAN(D) LET w=D(2)-D(1) GOTO 2 ELSE NOTE Enter the lower cutpoint of the first class and the class width. NOTE BRIEF 0 SET D; FILE "TERMINAL"; NOBS 2. LET w=D(2) LET M(1)=D(1)+0.5*w ENDIF MLABEL 2 LET xmax=MAX(C) LET n=N(C) LET LC(1)=M(1)-0.5*w LET UC(1)=LC(1)+w LET u=UC(1) LET k=1 WHILE u<=xmax LET k=k+1 LET M(k)=M(k-1)+w LET LC(k)=UC(k-1) LET UC(k)=LC(k)+w LET u=UC(k) ENDWHILE DO i=1:k LET a=LC(i) LET b=UC(i) LET D=(C>=a) AND (C