|
At 05:19 PM 8/9/2007, Björn Türoque wrote:
>I have a student dataset that has one record for
>each individual course enrollment. I would like
>to compute whether or not someone has enrolled
>in a course prior to the one they are currently
>taking. If a student has taken a course at a
>previous date I would like to have a new
>variable set up that indicates if this is not their first enrollment.
>
>I run into a problem with students who enroll in
>multiple courses simultaniously. I would like
>the data to reflect both of the first courses
>with the same start date are the first course
>the student enrolls in, instead of as a previous course.
>
>I have included data below, the variables Ihave
>reflects what I have been able to compute, and
>the variable Iwant is what I would ideally like to get.
|-----------------------------|---------------------------|
|Output Created |13-AUG-2007 11:22:26 |
|-----------------------------|---------------------------|
StuID CourseDate CourseNum Ihave Iwant
111 09/01/2006 357 0 0
111 09/01/2006 426 1 0
111 01/01/2007 427 1 1
111 01/01/2007 595 1 1
112 01/01/2007 101 0 0
112 03/04/2007 204 1 1
113 03/04/2007 101 0 0
113 03/04/2007 101 1 0
115 09/01/2006 101 0 0
115 03/04/2007 357 1 1
Number of cases read: 10 Number of cases listed: 10
* Try this. SPSS 15 draft output (WRR:not saved separately).
NUMERIC NotFirst (F2).
AGGREGATE OUTFILE=* MODE=ADDVARIABLES
/BREAK = StuID
/FrstDate = MIN(CourseDate).
COMPUTE NotFirst = (CourseDate GT FrstDate).
LIST.
List
|-----------------------------|---------------------------|
|Output Created |13-AUG-2007 11:27:26 |
|-----------------------------|---------------------------|
StuID CourseDate CourseNum Ihave Iwant NotFirst FrstDate
111 09/01/2006 357 0 0 0 09/01/2006
111 09/01/2006 426 1 0 0 09/01/2006
111 01/01/2007 427 1 1 1 09/01/2006
111 01/01/2007 595 1 1 1 09/01/2006
112 01/01/2007 101 0 0 0 01/01/2007
112 03/04/2007 204 1 1 1 01/01/2007
113 03/04/2007 101 0 0 0 03/04/2007
113 03/04/2007 101 1 0 0 03/04/2007
115 09/01/2006 101 0 0 0 09/01/2006
115 03/04/2007 357 1 1 1 09/01/2006
Number of cases read: 10 Number of cases listed: 10
===========================================
APPENDIX: Test data (from original posting)
===========================================
Data List LIST
/ StuID * CourseDate(ADATE) CourseNum Ihave Iwant.
Begin Data
111 09/01/06 357 0 0
111 09/01/06 426 1 0
111 01/01/07 427 1 1
111 01/01/07 595 1 1
112 01/01/07 101 0 0
112 03/04/07 204 1 1
113 03/04/07 101 0 0
113 03/04/07 101 1 0
115 09/01/06 101 0 0
115 03/04/07 357 1 1
END DATA.
FORMATS StuID CourseNum (F4)
/Ihave Iwant (F2).
LIST.
|