```Date: Fri, 10 Sep 2010 00:45:20 -0400 Reply-To: David Marso Sender: "SPSSX(r) Discussion" From: David Marso Subject: Re: FW: how to identify last item completed for each respondent Comments: To: David Millar NOTE That LOOP has an optional BY clause which accepts negative values ;-) HTH, David DATA LIST FREE / A1 to A10. begin data. 6 1 3 5 6 1 6 7 3 1 2 6 3 1 2 6 5 1 . . 6 7 5 3 6 7 1 . . . 1 6 5 3 6 1 3 5 . . 1 6 7 5 1 7 . . . . 6 3 6 1 5 3 6 7 1 . 3 6 7 1 3 6 1 3 . . end data. VECTOR A=A1 TO A10. LOOP #=10 TO 1 BY -1. DO IF NOT MISSING(A(#)). COMPUTE LAST=#. BREAK. END IF. END LOOP. LIST LAST. ---- LAST 10.00 8.00 7.00 8.00 6.00 9.00 8.00 Number of cases read: 7 Number of cases listed: 7 On Wed, 1 Sep 2010 16:48:12 +0100, David Millar wrote: > > >________________________________ >From: David Millar >Sent: Wednesday, September 01, 2010 3:24 PM >To: 'Cleland, Patricia (EDU)' >Subject: RE: how to identify last item completed for each respondent > >Patricia, the code below looks at missing responses at the end of two subtests - a 40 item vocab test and a 36 item comprehension test. It recodes a solid string of 9s at the end of a test from 9 (missing) to 7 (not presented). Does this do what you are looking for? It would be possible to add a line in to indicate what was the last completed item if you wanted. > >Best wishes > >David > > >_______________ > >compute addressrv=40. >compute addressrc=36. > >vector itemrv=rv1 to rv40. >vector itemrc=rc1 to rc36. > >loop #i=1 to 40. >do if (itemrv(addressrv)=9). >compute itemrv(addressrv)=7. >compute addressrv=addressrv-1. >else if (itemrv(addressrv) ne 9). >break. >end if. >end loop. > > >loop #i=1 to 36. >do if (itemrc(addressrc)=9). >compute itemrc(addressrc)=7. >compute addressrc=addressrc-1. >else if (itemrc(addressrc) ne 9). >break. >end if. >end loop. > >________________________________ >From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of Cleland, Patricia (EDU) >Sent: Wednesday, September 01, 2010 2:04 PM >To: SPSSX-L@LISTSERV.UGA.EDU >Subject: how to identify last item completed for each respondent > >For each respondent (record), I need to identify the last item completed on a survey. I know that I've seen this discussed on the list serve but a Google search and a search of the list serve archives don't turn up anything. > >Any help would be appreciated. > > >Pat > > ===================== To manage your subscription to SPSSX-L, send a message to LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD ```

Back to: Top of message | Previous page | Main SPSSX-L page