LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (December 2000)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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
Comments: cc: Bozena Zdaniuk <bozena+@PITT.EDU>
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


Back to: Top of message | Previous page | Main SPSSX-L page