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 (March 2011)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 28 Mar 2011 15:34:56 -0400
Reply-To:     Rich Ulrich <rich-ulrich@live.com>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Rich Ulrich <rich-ulrich@live.com>
Subject:      Re: ( very useful TO) but still having problem with Aggregate
              function
Comments: To: vard1tha@police.nsw.gov.au
In-Reply-To:  <OF45DDB347.B2CC6D58-ONCA257861.0006DF0C-CA257861.0008AB19@police.nsw.gov.au>
Content-Type: text/plain; charset="iso-8859-1"

> Date: Mon, 28 Mar 2011 12:34:40 +1100 > From: vard1tha@police.nsw.gov.au > Subject: ( very useful TO) but still having problem with Aggregate function > To: SPSSX-L@LISTSERV.UGA.EDU > [snip] > > It works but the problem is that the new data file is not picking up > records where the legalact date is the earliest. > It is creating a new data file but with the same number of records (as > in the original file). > > DATASET DECLARE true1. > AGGREGATE > /OUTFILE='true1' > /BREAK=EventRefNum to IncidentswithLA > /LegalActDate_min=MIN(LegalActDate). > > My original datafile contains 2255 records where two or more records > have the same eventrefnum and incidentrefnum but with differing > legalactdate. I need to pick the records with the earliest legalactdate > > Can you please tell me where I am going wrong?

It looks like you have all your variables specified as "Break" -- That will make every line unique when the details differ.

I think you say that you want to keep the FIRST record of ID/Event. If you use Aggregate, you want to break on ID and event after sorting on ID, event, and Date, specifying PRESORT.

Then the function that you use to select variables should be "First( var-list )".

If that is what you want, you can get the same result without using Aggregate or naming the variables. With the file sorted on ID and event, simply

Match files file= * /first= earliest. execute. select if earliest. execute.

-- Rich Ulrich

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