I have the following data set:
|3475 | PROF1 | 1988 | Undergraduate
|3478 | PROF2 | 1996 | Undergraduate
|3476 | PROF1 | 1998 | Master
|3479 | PROF2 | 2000 | Master
|3477 | PROF1 | 2002 | Doctoral
|3480 | PROF3 | 2004 | Doctoral
I am trying to do a script that accum the type of graduate by year, but, when change the scholing type decrease from another. I need to show something like this:
Undergraduate Master Doctoral
1988 1 0 0
1989 1 0 0
1990 1 0 0
1991 1 0 0
1992 1 0 0
1993 1 0 0
1994 1 0 0
1995 1 0 0
1996 2 0 0
1997 2 0 0
1998 1 1 0
1999 1 1 0
2000 0 2 0
2001 0 2 0
2002 0 1 1
2003 0 1 1
2004 0 0 2
Explaining: Until 1997 we had 2 undergraduate professors, so in 1998 one of them concluded a master degree, then we need to decrease the number of undergraduates in 1 because now we need to account him as a master and not an undergraduate, and the same for doctoral.
Somebody would help?