~comment TODO: Mark list of codes that you have finished with "X" code NEW: Handles up to 6 character filename extensions (was 4 max) CODING^QPX: Written by MB at CfMC: 4/11/96 This coding questionnaire has the following features: 1) Does coding 1 question at a time 2) You can change coding to another question at any time 3) When you are done coding a question, it asks you for another question to code 4) Shows study, time, case, and interviewer id on screen 5) Codes using NUMERIC questions, up to 6 responses for each question coded, up to 997 codes per question 6) Saves the interviewer ID of the person who coded each question Make the following changes to make this run on any job: 1) Change the study code, case id, data length, and text start location to match study being coded in the header >DEFINE @STUDY ORIGINAL2 >DEFINE @LENGTH 2000 >DEFINE @CASE_ID 1.5 >DEFINE @TEXT_START 1200 2) Change the question name extensions you wish to use for the coded questions. These may be 2-6 characters with letters or numbers only. If you use more than 2 characters, use the proper NUMCHARS# keyword below: >DEFINE @QLIST 02,2a,2b,04,4a,4b,05,07,24,37,44,46,48,51,61,62 >DEFINE @NUMCHARS2 2 ''>DEFINE @NUMCHARS3 3 ''>DEFINE @NUMCHARS4 4 ''>DEFINE @NUMCHARS4 5 ''>DEFINE @NUMCHARS4 6 3) Change the columns of the text questions to match the original qnaire ($T) >DEFINE @TEXT_QS 07,08,09,11,12,13,14,16,33,46,54,56,58,65,68,69 4) Change the columns to put the data in ($C) if necessary >DEFINE @CODE_COLUMNS 601,621,...,901 5) Change the MAXIMUM value for the codes of each question ($MAX) >DEFINE @MAX_CODES 20,50,90,120,150,35,110,130,20,50,90,120,150,35,110,130 6) Specify a location beyond the code columns and before the text area to put the 'newcode' question and possibly the interviewer ID of the person who coded each question >DEFINE @COL_EXTRA 1100 >LOCATION_FORMAT 1 >FILL_DEFINES_IN_QUOTES >PURGESAME ~PREP COMPILE -SPECS ''To not overwrite existing CHK and SUM files, ''But make a DB file with vars in it for Cleanit later [@STUDY,CASELENGTH=@LENGTH,TEXTSTART=@TEXT_START,CASEID=@CASE_ID,QFFFILE=CODE2,& COMMENT="CODING @STUDY",DB,SPECWID=128] ''Case ID variable to reference { Casid: @CASE_ID HIDE !VAR } ''Set up interviewer ID and time for display ''See end of qnaire to put this in your data set for logging who did '' coding on which question {Intvid: 12.4 !SPC,7 } {Time: 16.23 !SPC,4 } {!AUTORETURN} ''This asks which question to code when first start coding ''The 'scratch area' is blank so we know no coding has been done { Whichqn: .4 !IF LOCALSCR(1,1)=" " \B STUDY: @STUDY | | CODER: \:Intvid | \|Time WHICH QUESTION DO YOU WISH TO CODE? \(,5) !FLD >REPEAT $Q=@QLIST $Q Question $Q >ENDREPEAT >IFDEF @NUMCHARS2 (SKIPTO Quit) 99 None >ENDIF >IFDEF @NUMCHARS3 (SKIPTO Quit) 999 None >ENDIF >IFDEF @NUMCHARS4 (SKIPTO Quit) 9999 None >ENDIF >IFDEF @NUMCHARS5 (SKIPTO Quit) 99999 None >ENDIF >IFDEF @NUMCHARS6 (SKIPTO Quit) 999999 None >ENDIF } ''Put the question in the scratch area if first case {!IF LOCALSCR(1,2)=" " !SPC,K,1,Whichqn,4} ''Get the question to code from the scratch area {!SPC,L,Whichqn,1,4 } ''Set the default display to line 4, keep job info above that { \((4) !DISPLAY,2} ''This display only shows up if you do not have any cases left to code { \(1)\B STUDY: @STUDY | CASE: \|casid | CODER: \:Intvid | \:Time !DISP,2} ''This is for display of the question purposes and skip to correct SPC,P ''You cannot execute multiple SPC,Ps because you will get messages about '' "Out of cases" when their conditions are not true. ''Note the "??" response which will be returned if the code does not match '' the list {Showqn: [Whichqn] !FLD,A >REPEAT $Q=@QLIST (Skip Sp$Q) $Q Question $Q >ENDREPEAT >IFDEF @NUMCHARS2 ?? There is a problem >ENDIF >IFDEF @NUMCHARS3 ??? There is a problem >ENDIF >IFDEF @NUMCHARS4 ???? There is a problem >ENDIF >IFDEF @NUMCHARS5 ????? There is a problem >ENDIF >IFDEF @NUMCHARS6 ?????? There is a problem >ENDIF } { Problem: THERE IS A PROBLEM IN THE DESIGN OF THIS QUESTIONNAIRE! You have asked to code a question, that it doesn't know about. Talk to questionnaire designer to fix. Press any key to terminate this interview. !DISPLAY } ''Abort interview if there is a problem {!SPC,B } ''This is where we get the next case to code ''The program will walk through the file until the SPC,P,2 condition is TRUE ''Once you have an answer to the open-end and it has not been coded yet ''it will pick up the case >REPEAT $C=@CODE_COLUMNS;& $Q=@QLIST;& $T=@TEXT_QS; {Sp$Q: !IF CHECKTEXT([$T])>0 AND NOT([$C.3#1-997]) !SPC,P,2 } ''If you get to the end of the file and no case has been picked up, the program ''returns here with a blank data case; so, if the case id is blank, we know ''this has occurred, and we offer another question to be coded { !IF [Casid^^B] !GOTO,Donecode} ''This is a little tricky, you need to use \: on the intvid and time to ''display what they were when they were executed because ''their data location no longer has the same thing in it since we picked ''up a case to code since then; the case id will be correct so use \|casid. { \(1)\B STUDY: @STUDY | CASE: \|casid | CODER: \:Intvid | \:Time !DISP,2} {!GOTO, TX$Q} >END_REPEAT ''If you did not get a case, ask if want to code another question >REPEAT $Q=@QLIST;& $C=@CODE_COLUMNS;& $T=@TEXT_QS;& $MAX=@MAX_CODES; ''This picks up the answer from the existing text question {TX$Q: [$T] !TEXT,A } ''This is where you start filling in the codes ''Up to 6 responses allowed {O1$Q: [$C.3] QUESTION $Q TEXT TO CODE IS: "\:TX$Q:" \IPLEASE ENTER CODE 1-$MAX, 999 TO CODE THIS LATER, OR "NQ" TO CODE NEW QUESTION !NUM,Z,,1-$MAX,999,NQ} ''or !FLD,ZX,6 for multi-page responses ''USE &Ques$Q.cod for code lists if doing FIELD questions instead of NUMERICS ''&Ques$Q.cod ''Skip to next case if say leave this one alone {!IF O1$Q=999 !GEN,B,[O1$Q.15]} {!IF O1$Q$=" " !GOTO,Done } ''Skip to NEWCODE if asked to code a new question {!IF O1$Q$="NQ " !GEN,B,[O1$Q.15]} {!IF O1$Q$=" " !GOTO,Newcode } >REP $R=2,3,4,5,6;$O=3,6,9,12,15 {O$R$Q: [O1$Q+$O.3] QUESTION $Q TEXT TO CODE IS: "\:TX$Q:" \IPLEASE ENTER CODE 1-$MAX, OR 998 IF NO MORE CODES PREVIOUS CODES WERE: \|O1$Q.3| \|O1$Q+3.3| \|O1$Q+6.3| \|O1$Q+9.3| \|O1$Q+12.3| !NUM,Z,,1-$MAX,998} ''998= NO MORE CODES {!IF O$R$Q=998 !GEN,B,[O$R$Q]} {!IF O$R$Q$=" " !GOTO,Done} >ENDREPEAT {!GOTO,Done} >ENDREP ''Note: This only occurs if you have no case so cannot overwrite existing data {Donecode: !IF [Casid^^B] \B\:SHOWQN\E HAS NO MORE CASES TO BE CODED! DO YOU WISH TO CODE ANOTHER QUESTION, OR QUIT? \(,5) !FLD C Code another question = (SKIPTO Quit) Q Quit = } ''This can occur on a case or after all cases have been coded, so we need '' to put the answer somewhere there and blank columns {!COLUMN @COL_EXTRA } {Newcode: .4 CURRENT QUESTION BEING CODED: "\:SHOWQN" WHICH \UNEW\E QUESTION DO YOU WISH TO CODE? \(,5) !FLD >REPEAT $Q=@QLIST $Q Question $Q >ENDREPEAT >IFDEF @NUMCHARS2 (SKIPTO Quit) 99 No new questions to code >ENDIF >IFDEF @NUMCHARS3 (SKIPTO Quit) 999 No new questions to code >ENDIF >IFDEF @NUMCHARS4 (SKIPTO Quit) 9999 No new questions to code >ENDIF >IFDEF @NUMCHARS5 (SKIPTO Quit) 99999 No new questions to code >ENDIF >IFDEF @NUMCHARS6 (SKIPTO Quit) 999999 No new questions to code >ENDIF } ''Move the new question number to the local scratch area {!SPC,K,1,Newcode,4 } ''Abort interview and immediately get next case if ask to code a new question '' or ran out of codes and going to code a new question. {!SPC,H} ''If no more questions to do, quit to prompt {Quit: !SPC,B} ''Come here to get next guy to code {Done: !GOTO} ''Do this to save interviewer id who coded each question >REPEAT $Q=@QLIST {Iv$Q: .4 !IF Showqn($Q) !SPC,7,1,4} >END_REPEAT {!SPC,D} ''Write the case id back to the file {!SPC,W} ''This writes the case back to the file {!SPC,H} ''This aborts and goes to next case ~END