Hi I need to identify the Max score by exam. Here is an example of what the database looks like.
ID Exam_Code Score 1 ALX 60 1 ALX 80 1 ALX 78 2 ALX 75 2 BBH 78 2 BBH 50 3 SML 32 3 SML 90 3 ALX 15 3 ALX 70 4 RRT 45 4 BBH 67 4 ALX 75 5 BBH 87 There are a lot more exam codes and participants take the exams multiple times with different scores and sometimes the same scores. I basically need it to take only the max score for each exam and assign a filtering variable which I can then filter into a new dataset. Anyone have any ideas? Thanks |
I would use a custom table for this.
* Custom Tables. CTABLES /VLABELS VARIABLES=Uni_ID Codescore Exam DISPLAY=LABEL /TABLE Uni_ID > Codescore [S][MAXIMUM] BY Exam /CATEGORIES VARIABLES=Uni_ID Exam ORDER=A KEY=VALUE EMPTY=EXCLUDE. Matthew J Poes Research Data Specialist Center for Prevention Research and Development University of Illinois 510 Devonshire Dr. Champaign, IL 61820 Phone: 217-265-4576 email: [hidden email] -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Henry Park Sent: Wednesday, January 30, 2013 1:47 PM To: [hidden email] Subject: Identifying the highest score for duplicate IDs Hi I need to identify the Max score by exam. Here is an example of what the database looks like. ID Exam_Code Score 1 ALX 60 1 ALX 80 1 ALX 78 2 ALX 75 2 BBH 78 2 BBH 50 3 SML 32 3 SML 90 3 ALX 15 3 ALX 70 4 RRT 45 4 BBH 67 4 ALX 75 5 BBH 87 There are a lot more exam codes and participants take the exams multiple times with different scores and sometimes the same scores. I basically need it to take only the max score for each exam and assign a filtering variable which I can then filter into a new dataset. Anyone have any ideas? Thanks -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Identifying-the-highest-score-for-duplicate-IDs-tp5717831.html Sent from the SPSSX Discussion mailing list archive at Nabble.com. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
In reply to this post by Henry Park
Henry,
I think that what you need to use is the Aggregate command. Read up on it. Aggregate outfile='new file name.sav'/break=id exam_code/maxscore=max(score). I do not recall what aggregate does with records having the same maximum score. I assume the documentation will tell you. Gene Maguin -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Henry Park Sent: Wednesday, January 30, 2013 2:47 PM To: [hidden email] Subject: Identifying the highest score for duplicate IDs Hi I need to identify the Max score by exam. Here is an example of what the database looks like. ID Exam_Code Score 1 ALX 60 1 ALX 80 1 ALX 78 2 ALX 75 2 BBH 78 2 BBH 50 3 SML 32 3 SML 90 3 ALX 15 3 ALX 70 4 RRT 45 4 BBH 67 4 ALX 75 5 BBH 87 There are a lot more exam codes and participants take the exams multiple times with different scores and sometimes the same scores. I basically need it to take only the max score for each exam and assign a filtering variable which I can then filter into a new dataset. Anyone have any ideas? Thanks -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Identifying-the-highest-score-for-duplicate-IDs-tp5717831.html Sent from the SPSSX Discussion mailing list archive at Nabble.com. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
In reply to this post by Henry Park
I just noticed the bottom of your request. I have done this the same way, but then saving out the table I create from the custom table, and using a set of syntax code to create this "filter" from that dataset.
Note that this is all much more easily done through a database, and if that was possible, I would suggest switching the dataset to a database, doing this processing, then putting it back in SPSS if need be for an analysis. Matthew J Poes Research Data Specialist Center for Prevention Research and Development University of Illinois 510 Devonshire Dr. Champaign, IL 61820 Phone: 217-265-4576 email: [hidden email] -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Henry Park Sent: Wednesday, January 30, 2013 1:47 PM To: [hidden email] Subject: Identifying the highest score for duplicate IDs Hi I need to identify the Max score by exam. Here is an example of what the database looks like. ID Exam_Code Score 1 ALX 60 1 ALX 80 1 ALX 78 2 ALX 75 2 BBH 78 2 BBH 50 3 SML 32 3 SML 90 3 ALX 15 3 ALX 70 4 RRT 45 4 BBH 67 4 ALX 75 5 BBH 87 There are a lot more exam codes and participants take the exams multiple times with different scores and sometimes the same scores. I basically need it to take only the max score for each exam and assign a filtering variable which I can then filter into a new dataset. Anyone have any ideas? Thanks -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Identifying-the-highest-score-for-duplicate-IDs-tp5717831.html Sent from the SPSSX Discussion mailing list archive at Nabble.com. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
In reply to this post by Maguin, Eugene
If he wants a filtering variable -- instead of just finding the
maxvalue -- then he wants to add maxvalue to each record as his first step. Then, for filtering, he can construct whatever logic suits him. -- Rich Ulrich > Date: Wed, 30 Jan 2013 15:00:03 -0500 > From: [hidden email] > Subject: Re: Identifying the highest score for duplicate IDs > To: [hidden email] > > Henry, > I think that what you need to use is the Aggregate command. Read up on it. > > Aggregate outfile='new file name.sav'/break=id exam_code/maxscore=max(score). > > I do not recall what aggregate does with records having the same maximum score. I assume the documentation will tell you. > > Gene Maguin > > > > -----Original Message----- > From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Henry Park > Sent: Wednesday, January 30, 2013 2:47 PM > To: [hidden email] > Subject: Identifying the highest score for duplicate IDs > > Hi I need to identify the Max score by exam. Here is an example of what the database looks like. > > ID Exam_Code Score > 1 ALX 60 > 1 ALX 80 > 1 ALX 78 > 2 ALX 75 > 2 BBH 78 > 2 BBH 50 > 3 SML 32 > 3 SML 90 > 3 ALX 15 > 3 ALX 70 > 4 RRT 45 > 4 BBH 67 > 4 ALX 75 > 5 BBH 87 > > There are a lot more exam codes and participants take the exams multiple times with different scores and sometimes the same scores. I basically need it to take only the max score for each exam and assign a filtering variable which I can then filter into a new dataset. Anyone have any ideas? > > Thanks |
Administrator
|
And the OP said he wanted max score "by exam". If so, you don't want subject ID as a break variable in the AGGREGATE. Something like:
data list list / ID(f2.0) Exam_Code (A3) Score (f5.0). begin data 1 ALX 60 1 ALX 80 1 ALX 78 2 ALX 75 2 BBH 78 2 BBH 50 3 SML 32 3 SML 90 3 ALX 15 3 ALX 70 4 RRT 45 4 BBH 67 4 ALX 75 5 BBH 87 end data. AGGREGATE /OUTFILE=* MODE=ADDVARIABLES /BREAK=Exam_Code /Score_max=MAX(Score). compute MaxFlag = Score EQ Score_max. formats MaxFlag(f1). list. OUTPUT: ID Exam_Code Score Score_max MaxFlag 1 ALX 60 80 0 1 ALX 80 80 1 1 ALX 78 80 0 2 ALX 75 80 0 2 BBH 78 87 0 2 BBH 50 87 0 3 SML 32 90 0 3 SML 90 90 1 3 ALX 15 80 0 3 ALX 70 80 0 4 RRT 45 45 1 4 BBH 67 87 0 4 ALX 75 80 0 5 BBH 87 87 1
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
In reply to this post by Henry Park
Is this what you need?
DATA LIST FREE / ID (A) Exam_Code (A3) Score (F).
BEGIN DATA 1 ALX 60 1 ALX 80 1 ALX 78 2 ALX 75 2 BBH 78 2 BBH 50 3 SML 32 3 SML 90 3 ALX 15 3 ALX 70 4 RRT 45 4 BBH 67 4 ALX 75 5 BBH 87 END DATA. DATASET NAME exam. DATASET DECLARE temp.
AGGREGATE /OUTFILE='temp' /BREAK=ID Exam_Code /Score_max=MAX(Score). Andrés
PS If you want, you coul also add this:
DATASET ACTIVATE exam.
MATCH FILES /FILE=* /TABLE='temp' /BY ID Exam_Code Score. EXECUTE. So you would have the max indicator in your exam dataset -----"SPSSX(r) Discussion" <[hidden email]> escribió: ----- Para: [hidden email] |
Thanks! Bruce actually suggested aggregating the data earlier and it
worked out pretty well. Not exactly what I wanted but it works so I'll be happy with that. On Thu, Jan 31, 2013 at 9:25 AM, ANDRES ALBERTO BURGA LEON <[hidden email]> wrote: > Is this what you need? > > DATA LIST FREE / ID (A) Exam_Code (A3) Score (F). > BEGIN DATA > > 1 ALX 60 > 1 ALX 80 > 1 ALX 78 > 2 ALX 75 > 2 BBH 78 > 2 BBH 50 > 3 SML 32 > 3 SML 90 > 3 ALX 15 > 3 ALX 70 > 4 RRT 45 > 4 BBH 67 > 4 ALX 75 > 5 BBH 87 > END DATA. > DATASET NAME exam. > DATASET DECLARE temp. > AGGREGATE > /OUTFILE='temp' > /BREAK=ID Exam_Code > /Score_max=MAX(Score). > > Andrés > > PS If you want, you coul also add this: > > DATASET ACTIVATE exam. > MATCH FILES /FILE=* > /TABLE='temp' > /BY ID Exam_Code Score. > EXECUTE. > > So you would have the max indicator in your exam dataset > > > > -----"SPSSX(r) Discussion" <[hidden email]> escribió: ----- > > Para: [hidden email] > De: Henry Park > Enviado por: "SPSSX(r) Discussion" > Fecha: 30/01/2013 19:07 > Asunto: Identifying the highest score for duplicate IDs > > Hi I need to identify the Max score by exam. Here is an example of what the > database looks like. > > ID Exam_Code Score > 1 ALX 60 > 1 ALX 80 > 1 ALX 78 > 2 ALX 75 > 2 BBH 78 > 2 BBH 50 > 3 SML 32 > 3 SML 90 > 3 ALX 15 > 3 ALX 70 > 4 RRT 45 > 4 BBH 67 > 4 ALX 75 > 5 BBH 87 > > There are a lot more exam codes and participants take the exams multiple > times with different scores and sometimes the same scores. I basically need > it to take only the max score for each exam and assign a filtering variable > which I can then filter into a new dataset. Anyone have any ideas? > > Thanks > > > > -- > View this message in context: > http://spssx-discussion.1045642.n5.nabble.com/Identifying-the-highest-score-for-duplicate-IDs-tp5717831.html > Sent from the SPSSX Discussion mailing list archive at Nabble.com. > > ===================== > To manage your subscription to SPSSX-L, send a message to > [hidden email] (not to SPSSX-L), with no body text except the > > command. To leave the list, send the command > SIGNOFF SPSSX-L > For a list of commands to manage subscriptions, send the command > INFO REFCARD > -- Henry ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
Administrator
|
"Not exactly what I wanted "...
Well, if you were to describe exactly what you wanted you would probably have gotten it (want fries with that?)
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
No need to be a dick. I described how I wanted to make filter
variables but aggregating worked. You need to chill out. On Thu, Jan 31, 2013 at 11:41 AM, David Marso [via SPSSX Discussion] <[hidden email]> wrote: > "Not exactly what I wanted "... > Well, if you were to describe exactly what you wanted you would probably > have gotten it (want fries with that?) > > Henry Park wrote > Thanks! Bruce actually suggested aggregating the data earlier and it > worked out pretty well. Not exactly what I wanted but it works so > I'll be happy with that. > > On Thu, Jan 31, 2013 at 9:25 AM, ANDRES ALBERTO BURGA LEON > <[hidden email]> wrote: >> Is this what you need? >> >> DATA LIST FREE / ID (A) Exam_Code (A3) Score (F). >> BEGIN DATA >> >> 1 ALX 60 >> 1 ALX 80 >> 1 ALX 78 >> 2 ALX 75 >> 2 BBH 78 >> 2 BBH 50 >> 3 SML 32 >> 3 SML 90 >> 3 ALX 15 >> 3 ALX 70 >> 4 RRT 45 >> 4 BBH 67 >> 4 ALX 75 >> 5 BBH 87 >> END DATA. >> DATASET NAME exam. >> DATASET DECLARE temp. >> AGGREGATE >> /OUTFILE='temp' >> /BREAK=ID Exam_Code >> /Score_max=MAX(Score). >> >> Andrés >> >> PS If you want, you coul also add this: >> >> DATASET ACTIVATE exam. >> MATCH FILES /FILE=* >> /TABLE='temp' >> /BY ID Exam_Code Score. >> EXECUTE. >> >> So you would have the max indicator in your exam dataset >> >> >> >> -----"SPSSX(r) Discussion" <[hidden email]> escribió: ----- >> >> Para: [hidden email] >> De: Henry Park >> Enviado por: "SPSSX(r) Discussion" >> Fecha: 30/01/2013 19:07 >> Asunto: Identifying the highest score for duplicate IDs >> >> Hi I need to identify the Max score by exam. Here is an example of what >> the >> database looks like. >> >> ID Exam_Code Score >> 1 ALX 60 >> 1 ALX 80 >> 1 ALX 78 >> 2 ALX 75 >> 2 BBH 78 >> 2 BBH 50 >> 3 SML 32 >> 3 SML 90 >> 3 ALX 15 >> 3 ALX 70 >> 4 RRT 45 >> 4 BBH 67 >> 4 ALX 75 >> 5 BBH 87 >> >> There are a lot more exam codes and participants take the exams multiple >> times with different scores and sometimes the same scores. I basically >> need >> it to take only the max score for each exam and assign a filtering >> variable >> which I can then filter into a new dataset. Anyone have any ideas? >> >> Thanks >> >> >> >> -- >> View this message in context: >> >> http://spssx-discussion.1045642.n5.nabble.com/Identifying-the-highest-score-for-duplicate-IDs-tp5717831.html >> Sent from the SPSSX Discussion mailing list archive at Nabble.com. >> >> ===================== >> To manage your subscription to SPSSX-L, send a message to >> [hidden email] (not to SPSSX-L), with no body text except the >> >> command. To leave the list, send the command >> SIGNOFF SPSSX-L >> For a list of commands to manage subscriptions, send the command >> INFO REFCARD >> > > > > -- > Henry > > ===================== > To manage your subscription to SPSSX-L, send a message to > [hidden email] (not to SPSSX-L), with no body text except the > command. To leave the list, send the command > SIGNOFF SPSSX-L > For a list of commands to manage subscriptions, send the command > INFO REFCARD > > Please reply to the list and not to my personal email. > Those desiring my consulting or training services please feel free to email > me. > > > ________________________________ > If you reply to this email, your message will be added to the discussion > below: > http://spssx-discussion.1045642.n5.nabble.com/Identifying-the-highest-score-for-duplicate-IDs-tp5717831p5717853.html > To unsubscribe from Identifying the highest score for duplicate IDs, click > here. > NAML -- Henry |
Administrator
|
Let's see how your crappy attitude works around here in the future!
--
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
I didn't have a crappy attitude. I said thanks and just stated the
fact that I wanted filters but aggregating worked so I was happy with that. Your the one coming into the discussion with nothing to add and an attitude. On Thu, Jan 31, 2013 at 11:50 AM, David Marso [via SPSSX Discussion] <[hidden email]> wrote: > Let's see how your crappy attitude works around here in the future! > -- > > Henry Park wrote > No need to be a dick. I described how I wanted to make filter > variables but aggregating worked. You need to chill out. > > On Thu, Jan 31, 2013 at 11:41 AM, David Marso [via SPSSX Discussion] > <[hidden email]> wrote: >> "Not exactly what I wanted "... >> Well, if you were to describe exactly what you wanted you would probably >> have gotten it (want fries with that?) >> >> Henry Park wrote >> Thanks! Bruce actually suggested aggregating the data earlier and it >> worked out pretty well. Not exactly what I wanted but it works so >> I'll be happy with that. >> >> On Thu, Jan 31, 2013 at 9:25 AM, ANDRES ALBERTO BURGA LEON >> <[hidden email]> wrote: >>> Is this what you need? >>> >>> DATA LIST FREE / ID (A) Exam_Code (A3) Score (F). >>> BEGIN DATA >>> >>> 1 ALX 60 >>> 1 ALX 80 >>> 1 ALX 78 >>> 2 ALX 75 >>> 2 BBH 78 >>> 2 BBH 50 >>> 3 SML 32 >>> 3 SML 90 >>> 3 ALX 15 >>> 3 ALX 70 >>> 4 RRT 45 >>> 4 BBH 67 >>> 4 ALX 75 >>> 5 BBH 87 >>> END DATA. >>> DATASET NAME exam. >>> DATASET DECLARE temp. >>> AGGREGATE >>> /OUTFILE='temp' >>> /BREAK=ID Exam_Code >>> /Score_max=MAX(Score). >>> >>> Andrés >>> >>> PS If you want, you coul also add this: >>> >>> DATASET ACTIVATE exam. >>> MATCH FILES /FILE=* >>> /TABLE='temp' >>> /BY ID Exam_Code Score. >>> EXECUTE. >>> >>> So you would have the max indicator in your exam dataset >>> >>> >>> >>> -----"SPSSX(r) Discussion" <[hidden email]> escribió: ----- >>> >>> Para: [hidden email] >>> De: Henry Park >>> Enviado por: "SPSSX(r) Discussion" >>> Fecha: 30/01/2013 19:07 >>> Asunto: Identifying the highest score for duplicate IDs >>> >>> Hi I need to identify the Max score by exam. Here is an example of what >>> the >>> database looks like. >>> >>> ID Exam_Code Score >>> 1 ALX 60 >>> 1 ALX 80 >>> 1 ALX 78 >>> 2 ALX 75 >>> 2 BBH 78 >>> 2 BBH 50 >>> 3 SML 32 >>> 3 SML 90 >>> 3 ALX 15 >>> 3 ALX 70 >>> 4 RRT 45 >>> 4 BBH 67 >>> 4 ALX 75 >>> 5 BBH 87 >>> >>> There are a lot more exam codes and participants take the exams multiple >>> times with different scores and sometimes the same scores. I basically >>> need >>> it to take only the max score for each exam and assign a filtering >>> variable >>> which I can then filter into a new dataset. Anyone have any ideas? >>> >>> Thanks >>> >>> >>> >>> -- >>> View this message in context: >>> >>> >>> http://spssx-discussion.1045642.n5.nabble.com/Identifying-the-highest-score-for-duplicate-IDs-tp5717831.html >>> Sent from the SPSSX Discussion mailing list archive at Nabble.com. >>> >>> ===================== >>> To manage your subscription to SPSSX-L, send a message to >>> [hidden email] (not to SPSSX-L), with no body text except the >>> >>> command. To leave the list, send the command >>> SIGNOFF SPSSX-L >>> For a list of commands to manage subscriptions, send the command >>> INFO REFCARD >>> >> >> >> >> -- >> Henry >> >> ===================== >> To manage your subscription to SPSSX-L, send a message to >> [hidden email] (not to SPSSX-L), with no body text except the >> command. To leave the list, send the command >> SIGNOFF SPSSX-L >> For a list of commands to manage subscriptions, send the command >> INFO REFCARD >> >> Please reply to the list and not to my personal email. >> Those desiring my consulting or training services please feel free to >> me. >> >> >> ________________________________ >> If you reply to this email, your message will be added to the discussion >> below: >> >> http://spssx-discussion.1045642.n5.nabble.com/Identifying-the-highest-score-for-duplicate-IDs-tp5717831p5717853.html >> To unsubscribe from Identifying the highest score for duplicate IDs, click >> here. >> NAML > > > > -- > Henry > > Please reply to the list and not to my personal email. > Those desiring my consulting or training services please feel free to email > me. > > > ________________________________ > If you reply to this email, your message will be added to the discussion > below: > http://spssx-discussion.1045642.n5.nabble.com/Identifying-the-highest-score-for-duplicate-IDs-tp5717831p5717855.html > To unsubscribe from Identifying the highest score for duplicate IDs, click > here. > NAML -- Henry |
Administrator
|
PLONK!
--
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
This isn't 1994.
|
Free forum by Nabble | Edit this page |