| Date: | Wed, 22 Sep 2004 08:37:56 +0200 |
| Reply-To: | Spousta Jan <JSpousta@csas.cz> |
| Sender: | "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU> |
| From: | Spousta Jan <JSpousta@csas.cz> |
| Subject: | Re: Matching cases |
|
| Content-Type: | text/plain; charset="iso-8859-1" |
And there are at least two ways how to avoid recoding:
1) use COUNT with the keyword sysmis
2) use COMPUTE and the function nmiss.
Both ways are shown in this example syntax:
data list list / a b c .
begin data .
1
1 2 3
1 2
end data.
count nmiss1 = a b c (sysmis) .
compute nmiss2 = nmiss(a,b,c).
exe.
form all (f1).
HTH
Jan
-----Original Message-----
From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU]On Behalf Of Hector Maletta
Sent: Tuesday, September 21, 2004 10:35 PM
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: Re: Matching cases
You may recode the missing values to some non-missing value and then count
it. For instance:
IF (SYSMIS(var))newvar=999.
Do this for all your variables, then count the value 999 among them. I use a
rather odd value like 999 to make sure it is not already among the valid
values. Choose a suitable value for your case.
Hector
> -----Original Message-----
> From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU]
> On Behalf Of Victor Tarrago
> Sent: Tuesday, September 21, 2004 4:37 PM
> To: SPSSX-L@LISTSERV.UGA.EDU
> Subject: Re: Matching cases
>
>
> Dear Hector,
>
> Is it possible to count with that function how many missing
> values are?
>
> Thank you very much for yor help.
>
>
> Victor Tarragó Sanromà
> Acziona Quanlitative Market Consultants
> Tel. 00 34 93. 238.43.53
> Mòbil 00 34 630.91.68.08
> Fax. 00 34 93.238.45.99
> vtarrago@acziona.com
> www.acziona.com
>
>
> -----Mensaje original-----
> De: Hector Maletta [mailto:hmaletta@fibertel.com.ar]
> Enviado el: martes, 21 de septiembre de 2004 22:15
> Para: Victor Tarrago; SPSSX-L@LISTSERV.UGA.EDU
> Asunto: RE: Matching cases
>
> Victor,
> Use the COUNT function. It counts how many times a given
> value appears among a set of variables. Hector
>
> > -----Original Message-----
> > From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU]
> On Behalf
> > Of Victor Tarrago
> > Sent: Tuesday, September 21, 2004 1:13 PM
> > To: SPSSX-L@LISTSERV.UGA.EDU
> > Subject: Re: Matching cases
> >
> >
> > Dear SPSS experts,
> >
> > We've lots of variables. These variables could be missing (no
> > response) or values between 1 to 6, 8 to 10, 20 to 22, 30
> to 36 and 97
> > to 99. We need to create a new variable for each possible
> value that
> > counts the number of times each value apears everywhere in
> the set of
> > variables.
> >
> > Which is the fastest way to create those variables?
> >
> > Thank you in advance
> >
> >
> > Victor Tarragó Sanromà
> > Acziona Quanlitative Market Consultants
> > Tel. 00 34 93. 238.43.53
> > Mòbil 00 34 630.91.68.08
> > Fax. 00 34 93.238.45.99
> > vtarrago@acziona.com
> > www.acziona.com
> >
> >
> > -----Mensaje original-----
> > De: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU]
> En nombre de
> > Hector Maletta Enviado el: lunes, 23 de agosto de 2004 14:12
> > Para: SPSSX-L@LISTSERV.UGA.EDU
> > Asunto: Re: Matching cases
> >
> > Patrick:
> > Matching and merging the cases, as you intend to do, can be
> done by a
> > combination of commands, but as far as two records are to be merged
> > into one record with twice the number of variables, the
> variable names
> > MUST be changed because they must be unique. I propose the
> following
> > syntax: *This solution assumes there is maximum one
> repetition of the
> > same client and part codes. *If the same client buys the same part
> > more than two times the solution won't work. *Identify cases
> > with the same code and put them together in the file. SORT
> > CASES BY CLIENT_CODE PART_CODE. COMPUTE FLAG=(CLIENT_CODE =
> > LAG(CLIENT_CODE) AND PART_CODE=LAG(PART_CODE)).
> >
> > *Separate both sets of cases in separate files.
> > TEMPORARY.
> > SELECT IF (FLAG=1).
> > RENAME VARIABLES (var1 var2 var3 var 4 = avar1 avar2 avar3 avar4).
> > *Substitute proper variable names in the above command, for all
> > variables except client code and part code). SAVE OUTFILE
> > 'SECONDTIME.SAV'/drop flag.
> >
> > TEMPORARY.
> > SELECT IF (FLAG=0).
> > SAVE OUTFILE 'FIRSTTIME.SAV'/drop flag.
> >
> > *Merge the files.
> > *This part requires there is only one repetition of the same codes.
> > GET FILE 'FIRSTTIME.SAV'. MATCH FILES /FILE=*/FILE
> 'SECONDTIME.SAV'/BY
> > CLIENT_CODE PART_CODE. SAVE OUTFILE 'BOTHTIMES.SAV'.
> >
> > *In the new file, the second set of variables will be blank
> > (SYSMIS) for clients who do not have repeated the same part.
> >
> > Hope this helps.
> >
> > Hector
> >
> > > -----Original Message-----
> > > From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU]
> > On Behalf
> > > Of Kamau, Patrick
> > > Sent: Monday, August 23, 2004 8:53 AM
> > > To: SPSSX-L@LISTSERV.UGA.EDU
> > > Subject: Matching cases
> > >
> > >
> > > Hi all, I need help so urgently!
> > >
> > >
> > >
> > > I have a dataset of >80,000 records which contains many
> > variables two
> > > of which are 'client_code' and 'part_code' (both are
> string). If a
> > > client comes in with a partner, s/he is given a code, say
> > > 'client_code' =10111/03/0001 and on the same record, a
> > partner code is
> > > filled, say 'part_code' =10111/03/0002. On the same
> > dataset, there has
> > > to be another record with 'client_code' =10111/03/002 and
> > 'part_code'
> > > =10111/03/0001.
> > >
> > >
> > >
> > > I would like to match these two records and merge to one
> > record with
> > > double number of variables so that I can compare the
> variables, and
> > > for those which don't have a match, I can find out why. Example:
> > >
> > > client_code part_code
> > > sex age
> > > reason1 reason2 status
> > >
> > > 10111/03/0001 10111/03/0002 1
> > 23
> > > IDU no condom +VE
> > >
> > > 10111/03/0002 10111/03/0001 2
> > 20
> > > partner FSW +VE
> > >
> > > 10111/03/0320 1
> > > 19 MISS MISS -VE
> > >
> > > 10111/03/0305 10111/03/0340 1
> > 26
> > > MISS MISS +VE
> > >
> > >
> > >
> > > I would like this to be
> > >
> > > Aclient_code Bclient_code
> > > Asex Bsex
> > > Aage Bage Areason1
> > > Breason1.................................
> > >
> > > 10111/03/0001 10111/03/0002 1
> 2
> > > 23 20 IDU partner
> > >
> > > 10111/03/0305 10111/03/0340 1
> .
> > > 26 . MISS .
> > >
> > > . 10111/03/0320 .
> > > 1 . 19 . MISS
> > >
> > >
> > >
> > > Is there a way I can do this without renaming the variables
> > of one or
> > > both subsets of data (i.e. males to Avariable and females to
> > > Bvariable), and if no, is there an easier way of renaming
> > variables in
> > > SPSS.
> > >
> > >
> > >
> > > Your help will highly be appreciated.
> > >
> > >
> > >
> > > Thank you.
> > >
> > >
> > >
> > >
> > >
> > > Patrick Kamau
> > >
> > > Senior Data Manager (VCT)
> > >
> > > CDC - Nairobi
> > >
> > > P.O. Box 606 - 00621
> > >
> > > Nairobi, Kenya
> > >
> > >
> > >
> > > Tel: +254 (20) 273077(6-9)
> > >
> > > Fax: +254 (20) 2714745
> > >
> > > Mobile: +254 (722) 778208
> > >
> > >
> > >
> > > email:pkamau@cdcnairobi.mimcom.net
> > >
> >
>
|