Date: Fri, 23 Sep 2005 10:19:32 -0400
Reply-To: "S.P." <splou048@UOTTAWA.CA>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: "S.P." <splou048@UOTTAWA.CA>
Subject: selecting first case in a group of student records
Hello all,
I have been playing around with this for a few hours already and can't
figure it out...!
I have a big data file with student records from various classes and
schools. I am trying to create a file with only one record per class which
will give me the teacher information for that class.
The unique identifier for each teacher-classroom combination is
constructed of the following two variables : idteach idlink
Here is the syntax I have been using which works fine if the file does not
contain different IDLINK vars for one IDTEACH var (for example : I
sometimes have for idteach = 28288, two groups of students, IDLINK = 2 and
IDLINK = 3). I'm not sure if this is really clear but essentailly, I would
need to keep only the first record with identical IDTEACH and IDLINK vars.
I found this syntax on another web site and thought it would work...I
simply can't get it to work!!
* To delete records with identical var1, var2 and var3.
SORT CASES BY var1 var2 var3.
ADD FILES FILE=* /BY var1 var2 var3 /FIRST=first.
SELECT IF first.
MY syntax :
SORT CASES BY IDTEACH IDLINK.
ADD FILES FILE= 'C:\temp\datafile.sav'
/BY IDTEACH IDLINK /FIRST=first.
SELECT IF first.
save outfile = file1.
Thank you for your help...!!!!!