Use the LEAVE command to set up a case counter starting at 1 each time
variable x changes:
*since we're selecting on case order, make sure levels are contiguous.
sort cases by x.
*handle first case.
if ($casenum eq 1) select50 = 1.
*bump counter when current x same as prior x.
if (lag(x) eq x) select50=select50 + 1.
*reset counter when current x not same as prior x.
if (lag(x) ne x) select50=1.
leave select.
select if select50 le 50.
Now do your thing with the 500 cases.
-----Original Message-----
From: SPSSX(r) Discussion [mailto:
[hidden email]] On Behalf Of
vpathak
Sent: Monday, November 05, 2007 5:03 PM
To:
[hidden email]
Subject: selecting cases
Hello All,
I have an age x gender variable that is 10 levels and am trying to select
the first 50 cases within each of those 10 levels (total of 500 cases). I
tried using "N of Cases" and some combinations with "temporary" and "xsave"
but could not get it to work. Can anyone help me out?
Thank you kindly...
--
View this message in context:
http://www.nabble.com/selecting-cases-tf4755280.html#a13598385Sent from the SPSSX Discussion mailing list archive at Nabble.com.
=====================
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
=====================
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