BASIC program to build Facets data and specification files

Top Up Down  A A

Here is an example program, which writes Facets data records and also builds a table of element labels for the specification file, using this example data file.

 

123 665 25467

452 339 34245

312 034 34452

columns 1-3, "123" in record 1, are examinee identifiers

columns 5-7, "665" in record 1, are judge identifiers

columns 9-13, "25467" in record 1, are the ratings on items 1 to 5.

 

100 DIM JUDGE$(100), examinee$(1000) 'to hold elements

110 OPEN "raw.dat" FOR INPUT AS #1 'input the raw data

120 OPEN "dat.txt" FOR OUTPUT AS #2 'output the Facets data file

130 OPEN "spec.txt" FOR OUTPUT AS #3 'output part of the specification file

140 LASTITEM% = 5 'there are 5 items

150 IF EOF(1) THEN 340 'are we at end-of-file ?

160 LINE INPUT #1, l$ 'read in a record from the raw data file

170 FOR J% = 1 TO LASTJUDGE% 'look down list of judges

180 IF MID$(l$, 5, 3) = JUDGE$(J%) THEN 220 'have we met the judge in cols 5-7 already?

190 NEXT J%

200 LASTJUDGE% = LASTJUDGE% + 1: J% = LASTJUDGE% 'no, add a new judge

210 JUDGE$(J%) = MID$(l$, 5, 3) 'add new judge to the array

220 FOR E% = 1 TO LASTEXAMINEE% 'look down list of examinees

230 IF MID$(l$, 1, 3) = EXAMINEE$(E%) THEN 270 'have we met the examinee in cols 1-3?

240 NEXT E%

250 LASTEXAMINEE% = LASTEXAMINEE% + 1: E% = LASTEXAMINEE% 'no, add a new examinee

260 EXAMINEE$(E%) = MID$(l$, 1, 3) 'add new examinee to the array

270 RATING$ = "" 'clear rating hold area

280 FOR I% = 1 TO LASTITEM% 'now append ratings, in cols 9-13, one for each item

290 RATING$ = RATING$ + "," + MID$(l$, 8 + I%, 1)

300 NEXT I%

310 PRINT #2, STR$(J%) + ",1-" + STR$(LASTITEM%) + "," + STR$(E%) + RATING$  'output data

320 GOTO 150 'go back for next record

330  ' now write out the element labels into the specification file

340 PRINT #3, "Title=Example conversion" ' Facets specifications

350 PRINT #3, "Facets=3"

360 PRINT #3, "Model=?,?,?,R"

370 PRINT #3, "Data=dat.txt"

380 PRINT #3, "Labels="

390 PRINT #3, "1,Judges"

400 FOR J% = 1 TO LASTJUDGE%

410 PRINT #3, STR$(J%) + "=" + JUDGE$(J%) 'the judge elements

420 NEXT J%

430 PRINT #3, "*"

440 PRINT #3, "2,Items"

450 FOR I% = 1 TO LASTITEM%

460 PRINT #3, STR$(I%) + "=" + STR$(I%) 'the item elements

470 NEXT I%

480 PRINT #3, "*"

490 PRINT #3, "3,Examinees"

500 FOR E% = 1 TO LASTEXAMINEE%

510 PRINT #3, STR$(E%) + "=" + EXAMINEE$(E%) 'the examinee elements

520 NEXT E%

530 PRINT #3, "*"

540 CLOSE

550 STOP


Help for Facets Rasch Measurement Software: www.winsteps.com.