Date: Mon, 28 Mar 2011 15:34:56 -0400
Reply-To: Rich Ulrich <email@example.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Rich Ulrich <firstname.lastname@example.org>
Subject: Re: ( very useful TO) but still having problem with Aggregate
Content-Type: text/plain; charset="iso-8859-1"
> Date: Mon, 28 Mar 2011 12:34:40 +1100
> From: email@example.com
> Subject: ( very useful TO) but still having problem with Aggregate function
> To: SPSSX-L@LISTSERV.UGA.EDU
> 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.
> /BREAK=EventRefNum to IncidentswithLA
> 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
Match files file= * /first= earliest.
select if earliest.
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
For a list of commands to manage subscriptions, send the command