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
Content-Type: text/plain; charset=us-ascii
you may try the following sequence (substitute the right names for your
SORT CASES BY ID DATE.
IF ($CASENUM NE 1 AND ID NE LAG(ID))CHECKNUM=1.
IF ($CASENUM NE 1 AND ID = LAG(ID))CHECKNUM=LAG(CHECKNUM)+1.
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
IF ($casenum ne 1 and id=lag(id) and d>lag(date))
Make sure there are no missing values for ID and DATE.
Hope this helps.
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.
> Content-Type: text/plain;
> 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
> Hank Daley
> Policy Analyst
> <<Hank W. K. Daley (E-mail).vcf>>
> Content-Type: application/octet-stream;
> name="Hank W. K. Daley (E-mail).vcf"
> Content-Disposition: attachment;
> filename="Hank W. K. Daley (E-mail).vcf"
> FN:Daley, Henry