Hi statalist,

Please consider the following example data:
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input long id byte(year grade)
10001 10 4
10001 11 5
10001 12 6
10001 13 7
10002 10 5
10002 11 6
10002 12 7
10002 13 8
10003 10 4
10003 11 5
10003 12 6
10003 13 7
10004 10 4
10004 11 5
10004 12 6
10004 13 7
10005 10 5
10005 11 6
10005 12 7
10005 13 8
10007 10 5
10007 11 6
10007 12 7
10007 13 8
10008 10 2
10008 11 3
10008 12 4
10008 13 5
10009 10 6
10009 11 7
10009 12 8
10009 13 9
10010 10 3
10010 11 4
10010 12 5
10010 13 6
10011 10 5
10011 11 6
10011 12 7
10011 13 8
10012 10 3
10012 11 4
10012 12 5
10012 13 6
10013 10 5
10013 11 6
10013 12 6
10013 13 7
10014 10 4
10014 11 5
10014 12 6
10014 13 7
10015 10 4
10015 11 5
10015 12 6
10015 13 7
10016 10 4
10016 11 5
10016 12 6
10016 13 7
10017 10 3
10017 11 4
10017 12 5
10017 13 6
10018 10 4
10018 11 5
10018 12 6
10018 13 7
10019 10 5
10019 11 6
10019 12 7
10019 13 8
10020 10 4
10020 11 5
10020 12 6
10020 13 7
10021 10 4
10021 11 5
10021 12 6
10021 13 7
10023 10 5
10023 11 6
10023 12 7
10023 13 8
10024 10 5
10024 11 6
10024 12 7
10024 13 8
10025 10 5
10025 11 6
10025 12 7
10025 13 8
10026 10 3
10026 11 4
10026 12 5
10026 13 6
10027 10 4
10027 11 5
10027 12 6
10027 13 7
end
The above data shows education history of individual identified by the id variable. For instance, individual 10001 was in grade 4 in year 10. Now I want to flag those individuals who have repeated a grade during the given period (from year 10 to year 13). So the code should identify, by an id, if the value of grade has been repeated.

Any help in this regard would be greatly appreciated.
Thanks,