Dear Statalist users,

this is my first post in the forum and I am a Stata beginner, so please forgive me if my post does not comply with the niveau inhere.
After searching through manuals and the Forum I am still struggling to solve the following problem:

I have a panel dataset with two variables, ID and YearSC.

ID contains ids of individuals. Due to the panel nature of the dataset the same id can occur multiple times.
YearSC contains the date(type:int) when the individual last entered his current job. The same Id can have different values of YearSC.

I would like to count, for each different id, how many different values for YearSC it has and create the corrisponding CNT variable.

This is the result I would like to obtain.

ID YearSC CNT
111 1980 1
222 1985 2
333 1990 3
222 1985 2
222 2005 2
333 1990 3
333 1995 3
333 2000 3
111 1980 1

I hope I could be clear enough and sorry if this is too basic. I saw other similar posts but I couldn't work it out for my problem.

Thank you for your help.

Francesco