Filter Rows by value of another variable

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Filter Rows by value of another variable

jimjohn
i have an ID, which is a string variable. Another variable I have is AgeDiff. I have many different rows for each ID in my data. What I want to do is find all rows in which AgeDiff > 35. If AgeDiff is > 35 for a particular row, then I want to not only delete that row but delete all other rows that have the same ID as that row.

So, basically I want to remove all rows associated with an ID if I find that at least one of the row's of that ID has a value of AgeDiff > 35.

any ideas how to go about this in SPSS? Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: Filter Rows by value of another variable

Melissa Ives
Sure--do an aggregate outfile=* mode=addvariables, breaking on ID creating a new variable for max(AgeDiff).
Then select if the maxagediff is <= 35.

Use this format from SPSS help

AGGREGATE OUTFILE=* MODE=ADDVARIABLES
 /maxagediff['Maximum age difference'=max(agediff).

Melissa

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of jimjohn
Sent: Tuesday, September 09, 2008 1:54 PM
To: [hidden email]
Subject: [SPSSX-L] Filter Rows by value of another variable

i have an ID, which is a string variable. Another variable I have is AgeDiff.
I have many different rows for each ID in my data. What I want to do is find all rows in which AgeDiff > 35. If AgeDiff is > 35 for a particular row, then I want to not only delete that row but delete all other rows that have the same ID as that row.

So, basically I want to remove all rows associated with an ID if I find that at least one of the row's of that ID has a value of AgeDiff > 35.

any ideas how to go about this in SPSS? Thanks!
--
View this message in context: http://www.nabble.com/Filter-Rows-by-value-of-another-variable-tp19398853p19398853.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to [hidden email] (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

PRIVILEGED AND CONFIDENTIAL INFORMATION
This transmittal and any attachments may contain PRIVILEGED AND
CONFIDENTIAL information and is intended only for the use of the
addressee. If you are not the designated recipient, or an employee
or agent authorized to deliver such transmittals to the designated
recipient, you are hereby notified that any dissemination,
copying or publication of this transmittal is strictly prohibited. If
you have received this transmittal in error, please notify us
immediately by replying to the sender and delete this copy from your
system. You may also call us at (309) 827-6026 for assistance.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (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