We have data on when student go from one grade to another and want to estimate age-based transition probability from grades using longitudinal data. This is a puzzle to me. It is like markov and we want to use multinomial models. The output ideal is transition matrix shown by age. here is some data

Code:
input id state age
1 1 20
1 1 21
1 2 22
1 3 23
2 1 26
2 2 27
2 2 28
2 1 29
3 3 19
3 4 20
3 . .
3 . .
4 2 22
4 1 23
4 3 24
4 4 25