New ID variable using date variable

#1
I have a ID# for all my teachers but I noticed that there are some instances that an 2 or more teachers can have the same ID#. I want to create another unique ID# for teachers using my old ID # plus the month and date of their birthday. I have a day of birth variables which is storage as date (int).

ID Name DOB What I want
100 Maria 1/8/1985 10018
100 Jeff 27/12/1983 1002712


Thank you in advance,
Marvin
 

Englund

TS Contributor
#2
sort ID
qui gen ID_1 = ID
qui replace ID_1 = max(ID_1)+1 if ID_1 == ID_1[_n+1]

This code doesn't utilize the date of birth and it probably isn't the best way to solve the problem, but it should get the job done :)