110 IF (E2-EZ)*RND<NM-NT THEN NT=NT+1:EZ=EZ+1:EX(NT)=EZ:IF NT<NM THEN 110 ELSE 120
115 EZ=EZ+1:GOTO 110
120 TB=6:IF E2>10000 THEN TB=10
125 GOSUB 215:T=1:FOR Z=1 TO NM:PRINT #1,TAB(T);EX(Z);:T=T+TB:IF T>PMAX THEN T=1
130 NEXT:PRINT #1,:GOTO 265
135 PRINT TAB(26);"ASSIGN SUBJECTS TO TWO GROUPS":PRINT TAB(26);STRING$(29,205)
140 LOCATE 4,2:INPUT "Will subjects enter the study over a period of time longer than 1 month? ",A$:PRINT:AF=0
145 IF A$="y" OR A$="Y" THEN AF=1:PRINT "Then it is preferable to randomize SUBSETS independently to avoid seasonal bias":PRINT TAB(15);"and to asssure equal numbers of cases and controls":PRINT TAB(23);"should the study terminate early.":PRINT
150 D1="How many subjects ":IF AF=1 THEN PRINT TAB(8);D1;"are expected to enter the study each month?":AR=10:AC=70:GOSUB 4800:NN=VAL(IP$) ELSE PRINT TAB(13);D1;"(total) will be in the study?":AR=6:AC=62:GOSUB 4800:NN=VAL(IP$)
255 FOR Z=1 TO NM:PRINT #1,TAB(15);Z;:RN=RND:PRINT #1,TAB(PMAX/3+2);:IF RN<0.5 THEN PRINT #1,D1;TAB(PMAX*2/3+2);D2 ELSE PRINT #1,D2;TAB(PMAX*2/3+2);D1
260 NEXT
265 CLOSE #1:LOCATE 25,16:INPUT;"Do you want to perform another randomization? ",A$:IF A$="y" OR A$="Y" THEN 20
270 GOTO 3000
5000 BEEP:IF ERR<>53 AND ERR<>71 THEN 5010 ELSE LOCATE 2,10:PRINT "Please place EPISTAT in drive A: (or other default).":PRINT TAB(25);"Press any key to continue:"