I have a data set that is in the long format
ID Date
001 10/01/2007
001 01/02/2008
002 01/15/2008
002 02/20/2008
002 08/09/2008
I need to create a new variable called time that identifies for each subject whether their clinic visit (Date variable) represents their first visit, second visit etc
ID Date Time
001 10/01/2007 1
001 01/02/2008 2
002 01/15/2008 1
002 02/20/2008 2
002 08/09/2008 3
Can anyone kindly help me with this