LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (December 2000)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 7 Dec 2000 14:28:04 -0300
Reply-To:     "Hector E. Maletta" <hmaletta@OVERNET.COM.AR>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         "Hector E. Maletta" <hmaletta@OVERNET.COM.AR>
Subject:      Re: Mark sequence of records
Comments: To: hdaley@DMHMRSAS.STATE.VA.US
Content-Type: text/plain; charset=us-ascii

Hank, you may try the following sequence (substitute the right names for your variables):

SORT CASES BY ID DATE. IF ($CASENUM=1)CHECKNUM=1. IF ($CASENUM NE 1 AND ID NE LAG(ID))CHECKNUM=1. IF ($CASENUM NE 1 AND ID = LAG(ID))CHECKNUM=LAG(CHECKNUM)+1. EXECUTE.

The first command sorts the cases first by ID, and then by date of check within each ID. The second command creates a CHECKNUM variable and assigns the value 1.00 to the first case in the file. The third command assigns the value 1.00 to CHECKNUM for the first check of each subject. The fourth command increases CHECKNUM by 1 whenever a new record of a checking is encountered after the first one. Since the cases are sorted by ID and DATE, this will result in a numbering of checks in order of dates, without looking at the dates. However, it may be also done by augmenting CHECKNUM by 1 if the next date is greater than the preceding one, i.e. replacing the former fourth command by: IF ($casenum ne 1 and id=lag(id) and d>lag(date)) checknum=lag(checknum)+1. Make sure there are no missing values for ID and DATE. Hope this helps.

Hector Maletta Universidad del Salvador Buenos Aires, Argentina

Hank Daley wrote: > > This message is in MIME format. Since your mail reader does not understand > this format, some or all of this message may not be legible. > > ------_=_NextPart_000_01C06071.752261A7 > Content-Type: text/plain; > charset="iso-8859-1" > > I have outlets that get checked for compliance several times. > > So, if an outlet has been checked three times, it has three records each > with a different date checked, datechk. > > According to the date the outlet get gets checked for compliance, datechk, I > want to mark a record as the first time the outlet was checked, the second > time the outlet was checked, the third time the outlet was checked, etc. > > Reading through messages I am guessing use of the lag function will help me > do it, but most of the other solutions deal with deleting duplicates. I > simply want to mark mutliple records sequentially. > > So, the outlets id will appear multiple times but with a different date > checked. > > TIA. > > Hank Daley > Policy Analyst > > <<Hank W. K. Daley (E-mail).vcf>> > > ------_=_NextPart_000_01C06071.752261A7 > Content-Type: application/octet-stream; > name="Hank W. K. Daley (E-mail).vcf" > Content-Disposition: attachment; > filename="Hank W. K. Daley (E-mail).vcf" > > BEGIN:VCARD > VERSION:2.1 > N:Daley;Henry > FN:Daley, Henry > ORG:CO > EMAIL;PREF;INTERNET:hdaley@dmhmrsas.state.va.us > REV:20000922T175200Z > END:VCARD > > ------_=_NextPart_000_01C06071.752261A7--


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