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 (February 2005)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 1 Mar 2005 00:21:46 -0300
Reply-To:     Hector Maletta <hmaletta@fibertel.com.ar>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Hector Maletta <hmaletta@fibertel.com.ar>
Subject:      Re: eliminate records where the person was re-admitted on the
              same day that they were discharged
Comments: To: Thara Vardhan <Thara.Vardhan@djj.nsw.gov.au>
In-Reply-To:  <s224723e.004@csogw2.djj.nsw.gov.au>
Content-Type: text/plain; charset="us-ascii"

Thara, you can add to the condition is to select cases where the person is NOT the same as the precedent one.

SELECT IF (PERSONID NE LAG(PERSONID) OR (PERSONID = LAG(PERSONDID) AND ADMDATE NE LAG(DISDATE))).

But this would not explain why no case was selected with the original version. In the previous version the command selected only cases where the person was the same as the precedent one (and the admission date different from the previous discharge date). If you say such cases do exist, they should have been selected.

The only problem might be that admission and discharge dates are not comparable because of some difference in the spelling or format of the two variables. When the condition cannot be applied, the case is not selected, and therefore you end up without cases.

Hector

> -----Original Message----- > From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] > On Behalf Of Thara Vardhan > Sent: Monday, February 28, 2005 11:46 PM > To: SPSSX-L@LISTSERV.UGA.EDU > Subject: eliminate records where the person was re-admitted > on the same day that they were discharged > > > 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. >


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