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 (September 2005)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sun, 18 Sep 2005 18:33:42 -0400
Reply-To:     Raynald Levesque <rlevesque@videotron.ca>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Raynald Levesque <rlevesque@videotron.ca>
Subject:      Re: Aggregate problem
In-Reply-To:  <200509181532.j8IFWiDW013522@listserv.cc.uga.edu>
Content-type: text/plain; charset=us-ascii

Hi Stephen,

This is one way:

* I assume you have v13 and that the file is already sorted..

DATA LIST LIST /ID M R A. BEGIN DATA 1 1 4 0 1 2 5 0 1 3 1 1 1 4 2 0 2 1 3 0 2 2 6 0 2 3 3 1 2 4 4 2 3 1 4 0 3 2 4 0 3 3 9 1 3 4 1 1 END DATA.

AGGREGATE /BREAK=id /maxr=MAX(r). COMPUTE maxAttained = (maxr=r). SPLIT FILE BY id. - CREATE keepMax = CSUM(maxAttained). - CREATE keepA = CSUM(a). - SELECT IF (id=LAG(id) AND LAG(KeepMax)>0) OR (keepA >0). SPLIT FILE OFF. LIST ID M R A.

* This is the result of LIST. ID M R A

1.00 3.00 1.00 1.00 1.00 4.00 2.00 .00 2.00 3.00 3.00 1.00 2.00 4.00 4.00 2.00 3.00 3.00 9.00 1.00 3.00 4.00 1.00 1.00

Number of cases read: 6 Number of cases listed: 6

HTH

Raynald Levesque Raynald@spsstools.net Visit my SPSS site: http://www.spsstools.net

-----Original Message----- From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU]On Behalf Of Stephen Salbod Sent: September 18, 2005 11:33 AM To: SPSSX-L@LISTSERV.UGA.EDU Subject: Aggregate problem

Hi Everyone,

My problem is I do not understand how to use AGGREGATE with a comparison to drop records from a file.

M=Minutes R=Ratings A=Actions

ID M R A

1 1 4 0 1 2 5 0 1 3 1 1 1 4 2 0 2 1 3 0 2 2 6 0 2 3 3 1 2 4 4 2 3 1 4 0 3 2 4 0 3 3 9 1 3 4 1 1

I want to create a file that contains only those records that occur after a person maximum rating (MAX R) and all records following the first action (A > 0) . Here is the output file for the above data set:

ID M R A 1 3 1 1 1 4 2 0 2 3 3 1 2 4 4 2 3 3 9 1 3 4 1 1

Any help would be appreciated. I do have Levesque's book (2nd Editon), so feel free to direct me specific pages.

Thank you,

Stephen Salbod, Pace University, NYC


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