Date: Sun, 3 Dec 2000 11:05:27 -0500
Reply-To: Raynald Levesque <rlevesque@VIDEOTRON.CA>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Raynald Levesque <rlevesque@VIDEOTRON.CA>
Subject: Re: random selection
In-Reply-To: <NDBBIGEFDKFILJBFDGFPEELJCCAA.bozena@pitt.edu>
Content-Type: text/plain; charset="iso-8859-1"
Try this
DEFINE !match (nb=!TOKENS(1) /criter=!CMDEND)
COMPUTE flag=!criter.
EXECUTE.
TEMPORARY.
SELECT IF flag.
COMPUTE rvar=UNIFORM(1).
RANK rvar /RANK INTO sel.
COMPUTE x=(sel<=!nb).
RECODE x (SYSMIS=0).
EXECUTE.
!ENDDEFINE.
!match nb=5 criter=(varA=1 & VarB=3).
Regards
Raynald Levesque rlevesque@videotron.ca
-----Original Message-----
From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU]On Behalf Of
Bozena Zdaniuk
Sent: Friday, December 01, 2000 1:24 PM
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: random selection
I often need to create matched groups of cases with certain characteristics
for control purposes. Usually, I do it the "long way" by listing all the
potential members in the matched category and randomly selecting the number
of them that I need. This takes a lot of time. I wonder if the script can be
written that will ask SPSS to do it for me. I need a script that would run
something like that:
if (varA=1 and VarB=3) pick randomly 5 cases and mark them with the new
variable X=1.
Thanks a lot.
Bozena Zdaniuk
University of Pittsburgh