10  'PRELSA.BAS  1.0
11  DIM ITEM$(200),COL(200),NRANK(200),NEWRANK(200),III(200)
12  OPEN "O",#1,"INPUT"
14  PRINT " ":PRINT " ":PRINT " ":PRINT " ":PRINT " ":PRINT " ":PRINT " "
20  PRINT "1.  WHAT IS THE TITLE FOR THIS ANALYSIS?"
25  PRINT "(TYPE 80 ALPHANUMERIC COLUMNS OR LESS)"
30  INPUT " ";TITLE$:PRINT " "
35  PRINT #1,"TITLE"
40  PRINT #1,TITLE$
50  INPUT "2.  HOW MANY CASES ARE THERE IN THE RAW DATA FILE";NCASES$
70  PRINT #1,"NCASES"
80  PRINT #1,NCASES$
82  INPUT "3.  HOW MANY WAVES OF DATA ARE THERE";WAVES$
84  PRINT #1,"WAVES"
86  PRINT #1,WAVES$
90  PRINT " ":PRINT "4.  IS THIS A SUBSAMPLE ANALYSIS?"
100 PRINT "THAT IS, ARE YOU SUBSETTING THE SAMPLE?"
110 PRINT " 1 = YES"
115 PRINT " 2 = NO"
120 INPUT "  ";SELECT$:PRINT " "
130 IF SELECT$="2" THEN GOTO 170
140 PRINT #1,"SELECT"
145 PRINT "4B. WHAT VALUE ARE YOU SELECTING ON?"
147 PRINT "(VALUE OF THE SELECTION VARIABLE USED TO SELECT THE SUBSAMPLE)"
150 INPUT " ";VALUE$
160 PRINT #1,VALUE$
170 PRINT "5.  HOW MANY ITEMS ARE IN THE ANALYSIS?"
175 PRINT "(NUMBER OF ITEMS AT EACH WAVE X NUMBER OF WAVES)"
180 INPUT " ";NITEMS
190 PRINT " "
282 IF SELECT$="2" THEN GOTO 297
285 PRINT "                                  BEGINS IN      ENDS IN"
286 PRINT "                         NAME      COLUMN         COLUMN"
287 PRINT "                         --------------------------------"
289 PRINT "5B. SELECTION VARIABLE:"
290  INPUT "                         ";ITEM$(0)
292  INPUT "                                    ";COL0$
294  INPUT "                                                    ";COL0E$
296 PRINT " "
297 PRINT "6.  PLEASE TYPE THE ITEM NAME, COLUMN LOCATION (IN RAW DATA FILE),"
298 PRINT "AND RANK ORDER OF EACH ITEM IN THE ANALYSIS."
299 PRINT " "
300 PRINT "RANK ORDER 1 IS THE ITEM HYPOTHESIZED TO BE MOST PREVALENT"
302 PRINT "AT THE MOST RECENT WAVE.  RANK ORDER 2 IS THE ITEM HYPOTHESIZED"
304 PRINT "TO BE SECOND MOST PREVALENT AT THE MOST RECENT WAVE."
306 PRINT " "
307 PRINT "                      ITEM NAME     COLUMN NUMBER    RANK ORDER"
308 PRINT "                      -----------------------------------------"
310 FOR I=1 TO NITEMS
330  INPUT "                     ";ITEM$(I)
335  INPUT "                                      ";COL(I)
337  INPUT "                                                       ";NRANK(I)
340 NEXT I
342 PRINT #1,"HOWREAD"
344 GOSUB 1000
345   FOR K=1 TO NITEMS
346    NEWRANK(K)=NRANK(K):III(K)=K
347   NEXT K
348 GOSUB 2000
349 GOSUB 3000
350 PRINT #1,"ITEMS"
351 NIT$=STR$(NITEMS)
352 IF MID$(NIT$,IVI+1,1)=" " THEN IVI=IVI+1:GOTO 352
360 PRINT #1,MID$(NIT$,IVI+1,3)
370 FOR I=1 TO NITEMS
380 PRINT #1,USING "'&'    ###";ITEM$(I),III(I)
390 NEXT I
400 PRINT " "
402 PRINT "7.  DO YOU WANT TO CALCULATE ERRORS USING THE INTENSIVE COMPUTATION METHOD?"
410 PRINT " 1 = YES"
415 PRINT " 2 = NO"
420 INPUT " ";SELECT$
430 PRINT #1,"LCSMAX"
440 IF SELECT$="2" THEN GOTO 470
450 PRINT #1,"YES"
460 GOTO 480
470 PRINT #1,"NO"
480 PRINT " "
482 PRINT "8.  DO YOU WANT A PRINTOUT OF THE FREQUENCY OF RESPONSE PATTERNS?"
490 PRINT " 1 = YES"
495 PRINT " 2 = NO"
500 INPUT "  ";SELECT$
510 PRINT #1,"FREQUENCY"
520 IF SELECT$="2" THEN GOTO 550
530 PRINT #1,"YES"
540 GOTO 560
550 PRINT #1,"NO"
560 PRINT #1,"END"
565 PRINT " ":PRINT "INPUT FILE HAS BEEN CREATED.":PRINT " "
570 CLOSE
580 SYSTEM
590 END
1000 REM SORTING OF ITEMS
1010 G=INT(NITEMS/2)
1020 WHILE G<>0
1030  S=0
1040  WHILE S=0
1050   S=1
1060   FOR K=1 TO NITEMS-1
1070    IF COL(K)<=COL(K+1) THEN 1110
1080     T=COL(K):T$=ITEM$(K):T2=NRANK(K)
1090     COL(K)=COL(K+1):ITEM$(K)=ITEM$(K+1):COL(K+1)=T:ITEM$(K+1)=T$:NRANK(K)=NRANK(K+1):NRANK(K+1)=T2
1100     S=0
1110   NEXT K
1120  WEND
1130  G=INT(G/2)
1140 WEND
1150 RETURN
2000 REM PRODUCING HOWREAD FORMAT
2002 PRINT #1,"(";:GROUP=1
2003 IF SELECT$="2" THEN GOTO 2018
2004 IF MID$(COL0$,II+1,1)=" " THEN II=II+1:GOTO 2004
2005 LENGTH=VAL(COL0E$)-VAL(COL0$)+1
2006 LENG$=STR$(LENGTH)
2007 IF MID$(LENG$,IV+1,1)=" " THEN IV=IV+1:GOTO 2007
2008 TEMP$="T" + MID$(COL0$,II+1,3) + "," + "F" + MID$(LENG$,IV+1,3) + ".0,"
2009 PRINT #1,TEMP$;
2010 'IF SELECT$="2" THEN GOTO 2016
2011 'KK=K+1
2012 'FOR KK=1 TO NITEMS-1
2013 'FSPACE=COL(KK+1)-COL(KK)
2014 'IF FSPACE>1 THEN PRINT #1,USING ",##I";GROUP;:GROUP=1:GOTO 2014
2015 'GROUP=GROUP+1
2016 'NEXT KK
2017 'GOTO 2050
2018 COL1$=STR$(COL(1))
2019 IF MID$(COL1$,IIII+1,1)=" " THEN IIII=IIII+1:GOTO 2019
2020 TEMP$="T"+MID$(COL1$,IIII+1,3)
2021 PRINT #1,TEMP$;
2022 FOR K=1 TO NITEMS-1
2023 FSPACE=COL(K+1)-COL(K)
2024 IF FSPACE>1 THEN PRINT #1,USING ",##I1";GROUP;:GROUP=1:GOTO 2040
2030 GROUP=GROUP+1
2040 NEXT K
2050 IF FSPACE=1 THEN PRINT #1,USING ",##I1";GROUP;
2055 PRINT #1,")"
2060 RETURN
3000 REM SORTING OF NRANK
3010 G=INT(NITEMS/2)
3020 WHILE G<>0
3030  S=0
3040  WHILE S=0
3050   S=1
3060   FOR K=1 TO NITEMS-1
3070    IF NEWRANK(K)<=NEWRANK(K+1) THEN 3110
3080     T=NEWRANK(K):IT=III(K)
3090     NEWRANK(K)=NEWRANK(K+1):NEWRANK(K+1)=T:III(K)=III(K+1):III(K+1)=IT
3100     S=0
3110   NEXT K
3120  WEND
3130  G=INT(G/2)
3140 WEND
3150 RETURN