Date: Wed, 23 Feb 2005 11:50:46 -0800
Reply-To: Patrick MCINTIRE <Patrick.Mcintire@state.or.us>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Patrick MCINTIRE <Patrick.Mcintire@state.or.us>
Subject: Counting unique occurrences per client
Content-Type: text/plain; charset=US-ASCII
I am trying to count the number of unique services per client. I want
the code to read each record within a set of records per client, and
then count the unique services. There are duplicate services with
different episode dates per client, and there are several clients in the
file. I remember doing a similar routine in FORTRAN but can't seem to
get it to work in SPSS. So far, I've done the following:
DO IF (CLIENT EQ LAG(CLIENT)) AND SERVICE NE LAG(SERVICE)).
COUNT = COUNT + 1.
COMPUTE NUMSVC = MAX(COUNT).
IF (CLIENT NE LAG(CLIENT)) STOP = 1.
END IF (STOP = 1).
This does not accumulate a count of unique services per client. I also
tried a LOOP routine but it did the same as the above. Any ideas?
Thanks in advance.
Patrick McIntire, Ph.D.
Forecasting and Performance Measurement
Dept of Human Services
500 Summer St NE, E23
Salem, OR 97301-1067
Fax: 503 378-2897