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 (May 2011)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Sun, 8 May 2011 23:39:00 -0500
Reply-To:   Richard Ristow <wrristow@mindspring.com>
Sender:   "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:   Richard Ristow <wrristow@mindspring.com>
Subject:   Re: Incorporating Calculated Values Into Syntax
Comments:   To: "Krinsky, Alan" <Alan.Krinsky@UMASSMEMORIAL.ORG>
In-Reply-To:   <F51346EF966DB54E9E83EE981FA91E60043F89B1@UMMHCEXCHMB01.uma ssmemorial.org>
Content-Type:   text/plain; charset="us-ascii"; format=flowed

At 02:37 PM 5/5/2011, Krinsky, Alan wrote:

>Patients can have multiple visits and multiple prescriptions. For >now, let's say each patient-office visit is its own case, but each >patient has multiple prescriptions. I have one file of unique >patient-office visit combinations. And, I have each unique >patient-prescription date in a separate file

So: you have one file with one case per office visit, one file with one record per prescription, yes?

>For example, I need to figure out if a pharmacy prescription is >close to the date of a particular office visit.

It depends on what "close to" means. If you mean what prescriptions are near the office visit BUT AFTER IT, and before any later office visit -- that is, you're trying to find what office visit was the stimulus for writing each prescription -- it can be done with an ADD FILE in which visits and prescriptions are interleaved by patient and date, and you use LAG to carry over to each prescription the date of the last preceding office visit.

If, say, you want to find the closest office visit in either time direction for every prescription, you have a true many-to-many merge. That is now a solved problem (see "Many-to-many merge in SPSS", Thu, 26 Nov 2009); you can get a file of all pairs of office visits and prescriptions, and select from those the cases where the prescription is close to the date of the visit, by your criteria.

>To find out how many prescriptions per patient, I can do cases to >variables, or run an AGGREGATE command and get a count that way, >without restructuring.

Much the easier, I think.

>I then need to compare the office visit date with each prescription date.

Given that the solution you're describing is clumsy, and that there's no clear simplification of the selection logic, I suggest the many-to-many merge. That bypasses concern about maximum number of prescriptions per patient, etc; and since there'll be only one office visit and one prescription in each record, the selection logic is much simplified.

Let us know how it works out; especially, if there are any questions about the algorithm.

-Best wishes, Richard Ristow

===================== 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