id spec2010 grade2010 spec2011 grade2011 spec2012 grade2012 spec2013 grade2013
1 ren ct1 ren ct2 med st3 med st4
2 ren st7 ren st8 ren st8
3 . . . . car ct1 car ct2
4 res st4 res st5 . . . .
No. of grade 2010 2011 2012 2013 2014 2015 2016 2017
ct1
ct2
st3
st4


Hi,

I have a dataset that looks like the first table. I want to produce a frequeny table that gives the frequency of each grade per year. And to also be able to subdivide this by speciality. In my real dataset I have 8 possible grades for 2010-2017.

Can anyone give me any advice how to do this please?

Grateful for any help