Date: Sat, 29 Jun 2002 11:42:49 -0400
Reply-To: Mark Casazza <mark.casazza@verizon.net>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Mark Casazza <mark.casazza@verizon.net>
Subject: Re: syntax question
In-Reply-To: <5.1.0.14.0.20020629002326.00a61ec0@smtp.brisnet.org.au>
Hi Bob,
If I read your request correctly, what you need to do is get one case
from each study. The following creates a flag variable called first.
If the study id is different from the previous study id it is assigned a
value of 1. If the study id is the same as the previous one, it is
assigned a value of 0. You can then select the cases where first equals
1 to get one case for each study, or as I put in the syntax, just filter
by first and list out the flagged cases.
--
SORT CASES by studyid.
COMPUTE first = 1.
DO IF studyid NE lag(studyid).
. COMPUTE first = 1.
ELSE IF studyid EQ lag(studyid).
. COMPUTE first = 0.
END IF.
FILTER BY FIRST.
LIST.
--
HTH,
Mark
> -----Original Message-----
> From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU]
> On Behalf Of Bob Green
> Sent: Friday, June 28, 2002 11:30 AM
> To: SPSSX-L@LISTSERV.UGA.EDU
> Subject: syntax question
> Importance: Low
>
>
> I have a data set which consists of studies. For example, if
> study A had a
> 100 subjects, Study B had 150 subjects and Study C had 30
> subjects, the
> respective number of rows/cases for each study would be 100,
> 150 and 30.
>
> For each study the data contained in each row is identical
> (e.g they will
> have the same recruitment source, country of origin,
> diagnosis system used
> etc) except for substance use, for which some subjects are
> coded as present
> and some absent.
>
> What I want to do, so I can readily cross check data accuracy is to
> generate a record of one case from each study. Because each study is
> represented by multiple rows I can't filter cases by studyid. I could
> manually note a row from each study and then use syntax such as:
>
> SELECT IF(casen = 25 or casen =969 or casen =3256).
> EXECUTE .
>
> I would be interested in any more elegant or simpler syntax
> to perform this
> function. Any assistance is appreciated,
>
> Bob Green
>
|