Date: Tue, 1 Mar 2005 13:46:27 +1100
Reply-To: Thara Vardhan <Thara.Vardhan@djj.nsw.gov.au>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Thara Vardhan <Thara.Vardhan@djj.nsw.gov.au>
Subject: eliminate records where the person was re-admitted on the same
day that they were discharged
Content-Type: text/plain; charset=US-ASCII
Hi Hector
I tried the syntax that you have sent me but when i run the syntax i
have no records left in my data file. What have i done wrong?
What i am aiming to achieve is get a data file which will eliminate all
such records. I have checked my data file and i do have records where
the person has been re-admitted the same day that they were discharged.
I would really appreciate it if you could help me solve this problem.
regards
thara
Thara:
The simplest syntax is as follows:
SELECT IF (personid=lag(personid) and admdate NE LAG(disdate)).
This selects all records where the two records belong to the same
person and
the second admission date is not equal to the discharge rate in the
precedent entry.
I recommend you save the working file (after this SELECT IF) under a
new
name. Otherwise you will lose the deleted records forever, not a very
clever
idea in general.
Hector
> -----Original Message-----
> From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU]
> On Behalf Of Thara Vardhan
> Sent: Monday, February 28, 2005 9:45 PM
> To: SPSSX-L@LISTSERV.UGA.EDU
> Subject: eliminate records where the person was re-admitted
> on the same day that they were discharged
>
>
> Dear List members
>
> can you please help me with a syntax for the following problem
>
> I want to eliminate records where the person was re-admitted
> on the same day that they were discharged. I want to write
> the syntax that will delete record b.
>
>
> for example my data contains records like these
>
> Personid admdate disdate
> 17152 27-MAY-2003 18-JUL-2003
> 17152 18-JUL-2003 26-SEP-2003
>
> Looking forward to your reply.
>
> regards
> thara
>
>
> Thara Vardhan
> Senior Project Officer
> Research, Planning & Evaluation Branch
> Tel: (02) 9219-9515
>
>
> This message is intended for the addressee named and may
> contain confidential information. If you are not the
> intended recipient, please delete it and notify the sender.
> Views expressed in this message are those of the individual
Thara Vardhan
Senior Project Officer
Research, Planning & Evaluation Branch
Tel: (02) 9219-9515
This message is intended for the addressee named and may contain confidential information. If you are not the intended recipient, please delete it and notify the sender. Views expressed in this message are those of the individual sender, and are not necessarily the views of the Department of Juvenile Justice.