Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: student duration model


From   Maarten buis <[email protected]>
To   stata list <[email protected]>, [email protected]
Subject   st: student duration model
Date   Mon, 21 Jan 2008 15:48:51 +0000 (GMT)

Cliff Lipscomb had trouble posting a message to Statalist, here is my
try, and at the bottom also my solution:

Hi all � 
I have a dataset that has one observation for each semester in which a
student is enrolled at a university.  I have a variable "entry" that
indicates the semester in which the student enters the university, a
variable "graduation" that indicates the semester in which the student
graduates, and "cohort_time" indicates the semester in which a student
enters the university (the range of this variable is 1 to 25).  Here is
the problem � I need to create a dataset that only has ONE observation
per student.  This new dataset needs to include the variable "id" and
"duration" that will measure the number of semesters in which the
student was enrolled at the university.  I imagine that I will need to
count the number of observations per student in the original dataset
because some students don�t graduate at all (i.e. they transfer
elsewhere).  Here is an example where Id==12 and id==14 graduate and
id==13 enters college but does not graduate. Any help is greatly
appreciated.

Id            graduation          cohort_time       entry
12           0                              13      1
12           0                              13      0
12           1                              13      0
13           0                              1       1
13           0                              1       0
13           0                              1       0
13           0                              1       0
13           0                              1       0
13           0                              1       0
14           0                              11      1
14           0                              11      0
14           0                              11      0
14           0                              11      0
14           1                              11      0


Desired dataset (written out to a new Stata file):
Id           cohort_time	duration               graduate
12           13			3                      1
13            1			6                      0
14           11			5                      1


Thanks,
Cliff

Here is my (Maarten) Solution:

*------------------------- begin example ----------------------
drop _all
input Id            graduation          cohort_time       entry
12           0                              13      1
12           0                              13      0
12           1                              13      0
13           0                              1       1
13           0                              1       0
13           0                              1       0
13           0                              1       0
13           0                              1       0
13           0                              1       0
14           0                              11      1
14           0                              11      0
14           0                              11      0
14           0                              11      0
14           1                              11      0
end

collapse (mean) cohort_time         ///
         (count)duration=graduation ///
         (sum) graduation           ///
         , by(Id)
list
*------------------------- end example ------------------------
(For more on how to use examples I sent to the Statalist, see
http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html )

Hope this helps,
Maarten

-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


      ___________________________________________________________
Support the World Aids Awareness campaign this month with Yahoo! For Good http://uk.promotions.yahoo.com/forgood/
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index