Date: Mon, 14 Mar 2005 17:17:35 +0100
Reply-To: Victor Tarrago <email@example.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Victor Tarrago <firstname.lastname@example.org>
Subject: Re: INDIVIDUALS (CASES) IN MULTIPLE LINES
Content-Type: text/plain; charset="iso-8859-1"
Thank you to Gene Magin, Hillel Vardi and Richard Ristow for your help.
For each treatment we have common variables (description of treatment, cost,
date, doctor...). That means that we can have a line for each patient, but
the number of variables will depend on the number of treatments. We're going
to use varstocases.
De: Richard Ristow [mailto:email@example.com]
Enviado el: viernes, 11 de marzo de 2005 20:42
Para: Victor Tarrago; SPSSX-L@LISTSERV.UGA.EDU
Asunto: Re: INDIVIDUALS (CASES) IN MULTIPLE LINES
At 10:38 AM 3/11/2005, Victor Tarrago wrote:
>Each individual in [our] file has as many lines, as medical treatments
>he have received and we would like to have this multiple lines as a
>single one. There is no variable with the number of treatments
>received. For each line we have the patient code and not all
>individuals have the same number of lines. The treatment received is a
This is what AGGREGATE was invented for. To get the number of
treatments for each patient, load your file as the working file, and
run (not tested)
/BREAK = PT_CODE
/N_TREAT 'No. of treatments for patient' = N.
FORMATS N_TREAT(F3) /* Not required */.
(This destroys the working file; make sure your file is in a permanent
.SAV file, first.)
You'll have two variables in your working file: PT_CODE and N_TREAT.
You'll have one record for each PT_CODE, and the number of treatments
that patient received.
When you make a single line per patient, what else would you like in
it? Number of treatments of a certain kind? Dates of first and last
treatment? Or what? Most such problems can be solved with AGGREGATE,
but the question, first, is, what do you want?