Search through the file

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

Search through the file

behnaz shirazi-2
Hello all:

Do you know how I can find those records that they have same "clientid" but
different "Birthdates" through spss code?


Thank you
Behnaz

_________________________________________________________________
Don't just search. Find. Check out the new MSN Search!
http://search.msn.com/
Reply | Threaded
Open this post in threaded view
|

Re: Search through the file

Richard Ristow
At 04:58 PM 10/31/2006, behnaz shirazi wrote:

>Do you know how I can find those records that they have same
>"clientid" but
>different "Birthdates" through spss code?

I'm guessing that, if the birthdates aren't consistent, you want ALL
the records for that client.

Something like this, untested. It selects all records for any client
for which
. Any birthdate is missing, or
. There is more than one birthdate value.

I don't usually give this warning, but this deletes all unselected
records from the working file. Be sure the main file is saved in a safe
place.

TEMPORARY.
RECODE BrthDate (MISSING = 1) (ELSE = 0)
        INTO BrthMsg.
AGGREGATE OUTFILE=* MODE=ADDVARIABLES
    /BREAK=Client
    /NRecords 'Number of records for client'
              = N
    /NMissBdt 'Numb. records w. missing DOB'
              = SUM(BrthMsg)
    /FrstBdt  'Earliest date-of-birth for client'
              = MIN(BrthDate)
    /LastBdt  'Latest   date-of birth for client'
              = MAX(BrthDate).

FORMATS NRecords NMissBdt (F4).
SELECT IF NMissBdt GT 0
        OR FrstBdt  NE LastBdt.