Select based on one class, save records of all other classes

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Select based on one class, save records of all other classes

Laura Berry, Dr.
Dear SPSSers:

Sorry that my subject line isn't terribly descriptive.  Here's what I'm trying to do.  Our enrollment files have a list of each "student-course" enrollment combination.  So if student A enrolls in 5 classes, there will be 5 separate records.  I want to identify students who enrolled in, say, Freshman English (that's one record), then select the other records for those students (but not select records for students who didn't take Freshman English).

The intent is to take a look at which courses were likely to be taken by students who enrolled in Freshman English - we're trying to put together some block scheduling of classes.

I'm grateful for any suggestions.

Thanks,
Laura

Laura Berry, Ed.D
Dean of Arts & Sciences
North Arkansas College
870.391-3280

====================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
Reply | Threaded
Open this post in threaded view
|

Re: Select based on one class, save records of all other classes

David Wasserman
Try this (assuming student identifier is stu_id and Freshman English
identifier is value "Eng101" of variable course):

Sort cases by stu_id.

Temporary.
Select if course eq 'Eng101'.
Save outfile = temp1.sav/keep = stu_id.

Match files file = *
           /table = temp1.sav/in = inEng101
           /by stu_id.

Select if inEng101.


This will give you a data file with only students in Freshman English.  Be
careful to do this on a copy of your original file.


David Wasserman
Educational Data Consultant

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Laura Berry, Dr.
Sent: February-13-08 7:06 AM
To: [hidden email]
Subject: Select based on one class, save records of all other classes

Dear SPSSers:

Sorry that my subject line isn't terribly descriptive.  Here's what I'm
trying to do.  Our enrollment files have a list of each "student-course"
enrollment combination.  So if student A enrolls in 5 classes, there will be
5 separate records.  I want to identify students who enrolled in, say,
Freshman English (that's one record), then select the other records for
those students (but not select records for students who didn't take Freshman
English).

The intent is to take a look at which courses were likely to be taken by
students who enrolled in Freshman English - we're trying to put together
some block scheduling of classes.

I'm grateful for any suggestions.

Thanks,
Laura

Laura Berry, Ed.D
Dean of Arts & Sciences
North Arkansas College
870.391-3280

=======
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
Reply | Threaded
Open this post in threaded view
|

Re: Select based on one class, save records of all other classes

Woodward, Charlotte
In reply to this post by Laura Berry, Dr.
Dr. Berry,
I've had to do this to select students for surveys so we get as large an
unduplicated headcount as we could.

In the file with the students and classes, select cases for the Freshman
English class (Data/Select Cases/If...)

Once those cases are filtered, aggregate the remaining cases on IDNO
(assuming that's the student ID number) into a temporary file
AGGREGATE
  /OUTFILE=aggr.sav
  /BREAK=idno
  /N_BREAK=N.

Open the aggr.sav file and compute N as 1.  Save it and close it.

With the students and classes file open, match the file with the aggr.sav
file.  SORT CASES BY idno (A).
MATCH FILES /FILE=*
 /TABLE=aggr.sav
 /BY idno.
EXECUTE.

In the file with students and classes, you will now have a new variable 'N'
with a value of 1 for each class for each student who took Freshman English.

If you filter cases for N=1, you will see all of the classes for the
students who took Freshman English.

I realize this is a bit awkward, but it has been a quick way for me.

Charlotte Woodward
Data Coordinator/Analyst
Office of Planning and IR
Marywood University, Scranton, PA
[hidden email]

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: Select based on one class

Richard Ristow
In reply to this post by Laura Berry, Dr.
At 09:05 AM 2/13/2008, Laura Berry, Dr. wrote:

>Our enrollment files have a list of each "student-course" enrollment
>combination.  So if student A enrolls in 5 classes, there will be 5
>separate records.  I want to identify students who enrolled in, say,
>Freshman English (that's one record), then select the other records
>for those students (but not select records for students who didn't
>take Freshman English).

You've had a couple of solutions that should work. This may be a
little simpler. This is draft output; test data, and code without
listing, are t the end of this posting. Select on new variable "Takes_FE".

|-----------------------------|---------------------------|
|Output Created               |15-FEB-2008 13:07:14       |
|-----------------------------|---------------------------|
Student   Course

Arnold    Freshman English
Arnold    Introductory French
Arnold    Introduction to Economics
Betty     Quantum Physics
Betty     Calculus of Variations
Betty     Symbolic Logic
Charles   General Science
Charles   Freshman English

Number of cases read:  8    Number of cases listed:  8


TEMPORARY.
COMPUTE   IS_FE = Course EQ 'Freshman English'.
FORMATS   Is_FE (F2).

AGGREGATE OUTFILE=* MODE=ADDVARIABLES
    /BREAK=Student
    /Takes_FE 'Student takes Freshman English' = MAX(Is_FE).

LIST.

List
|-----------------------------|---------------------------|
|Output Created               |15-FEB-2008 13:07:14       |
|-----------------------------|---------------------------|
Student   Course                       Takes_FE

Arnold    Freshman English                 1
Arnold    Introductory French              1
Arnold    Introduction to Economics        1
Betty     Quantum Physics                  0
Betty     Calculus of Variations           0
Betty     Symbolic Logic                   0
Charles   General Science                  1
Charles   Freshman English                 1

Number of cases read:  8    Number of cases listed:  8
=================================
APPENDIX: Test data and full code
=================================
DATA LIST FIXED/
    Student  01-09 (A)
    Course   11-38 (A).

BEGIN DATA
Arnold    Freshman English
Arnold    Introductory French
Arnold    Introduction to Economics
Betty     Quantum Physics
Betty     Calculus of Variations
Betty     Symbolic Logic
Charles   General Science
Charles   Freshman English
END DATA.

LIST.

TEMPORARY.
COMPUTE   IS_FE = Course EQ 'Freshman English'.
FORMATS   Is_FE (F2).

AGGREGATE OUTFILE=* MODE=ADDVARIABLES
    /BREAK=Student
    /Takes_FE 'Student takes Freshman English' = MAX(Is_FE).

LIST.

=====================
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