Remove a record after matching

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

Remove a record after matching

San K
Hello,
I am currently evaluating a various water saving schemes using control method.
I have a sample.sav and a household.sav.
For each record in the sample, I want to
- rank the household.sav  (based on certain criteria )
- pick the best one
- remove the picked one from household.sav
then move to next record and do the same.

Has anyone done anything similar? Any directions would be helpful.

Thanks,
San

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: Remove a record after matching

Maguin, Eugene
San,

I think more information is needed about the file structures of the two
files and how they relate to each other. What is the sample file about? What
is the household file about? That information aside, I think you will have
to link the two files via a match files command. In spss syntax you can not
carry information from file to another except via save outfile and match
files commands. Although I don't know whether you can do that in python or
in script, I'd be ready to bet that you can.

Gene Maguin

I am currently evaluating a various water saving schemes using control
method.
I have a sample.sav and a household.sav.
For each record in the sample, I want to
- rank the household.sav  (based on certain criteria )
- pick the best one
- remove the picked one from household.sav
then move to next record and do the same.

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: Remove a record after matching

Richard Ristow
In reply to this post by San K
At 03:14 AM 9/29/2008, San K wrote:

>I have a sample.sav and a household.sav.
>For each record in the sample, I want to
>- rank the household.sav  (based on certain criteria )
>- pick the best one
>- remove the picked one from household.sav

This is only possible if household.sav has a variable (I'll say
'Sample#') identifying what sample the household is in. But you must
have that, or you couldn't merge with sample.sav, and it looks like
you want to.

The following code (untested), when run on household.sav, should drop
the household with highest value of 'Criteria' in each sample. (>If
more than one household has that highest value, it will drop them
all.<  It's a little more complicated, if that's a problem.)

AGGREGATE
    OUTFILE=*  MODE=ADDVARIABLES
   /BREAK=Sample#
   /BestCrit "Best 'Criteria' value in this sample' = MAX(Criteria).

SELECT IF Criteria LT BestCrit.

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