Date: Sat, 22 Mar 2003 14:45:22 0
Reply-To: Valentim Rodrigues Alferes <valferes@FPCE.UC.PT>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Valentim Rodrigues Alferes <valferes@FPCE.UC.PT>
Subject: Re: need help with counting multiple records on the same people
Content-Type: text/plain; charset=iso-8859-1
Hi Dick.
* Your data.
DATA LIST FREE/id(F8.0) name(A10) group(F8.0) latest(F8.0) spell(F8.0).
BEGIN DATA
2 jones 2 37 5
3 mary 1 8 1
1 smith 1 9 2
3 mary 1 23 4
3 mary 1 14 3
2 jones 2 32 3
2 jones 2 26 2
1 smith 1 19 1
1 smith 1 13 3
2 jones 2 12 4
3 mary 1 10 2
2 jones 2 16 1
END DATA.
LIST.
* The following syntax does your job.
SORT CASES BY id(A) spell(D).
COMPUTE K=1.
EXECUTE.
AGGREGATE/OUTFILE=*/BREAK=id name/events=SUM(k)/group=FIRST(group)
/latest=FIRST(latest)/spell=FIRST(spell).
FORMATS events (F8.0).
LIST.
Valentim Alferes
http://www.fpce.uc.pt/nucleos/niips/spss_prc/index.htm
hi,
I am working on a project in which, to analyze different aspects or
characteristics of a population, we have to get various pieces of data from
several relational databases.
I have constructed a table in this fashion. my aim is to count the number of
placement events for each unique member of this population.
the table, as it stands at the beginning, contains the id # of the members of
the population (in the variable, ID) BUT there may be more than one record
for a given unique ID, because that person may have had more than one
placement event (variable "event").
so what I want to do next is to create a table that will
-- retain the unique IDs
-- for each unique ID compute a new variable which will be the number of
events listed for that particular id. e.g.
jones 5
smith 3
-- in the process I would also like to retain, in the new table, some of the
variables in the original table..
for example, the population is divided into control or experimental group, so
I need to retain that variable "group". I also need to retain another
variable which describes the character of the "latest" event.
finally, there is a variable in the original table called "spell". here,
basically, the highest number in this variable indicates the most recent
event. for example, if an ID has 3 events listed, and there are spell
variables of 1,2,3, 3 would represent the latest event occurring.
given the fact that our population in this study is "only" 869, I could
probably do this manually; but I would like to know how to do this in SPSS.
I am still in the process of learning more about SPSS and I hope that the
more I learn, the more I will be able to give back. I am working through some
of the online tutorials that have been suggested to me and they are helpful.
thank you.
dick louderman