Hello,
I have a data set where each record is identified by a record id. Multiple records share a similar unique id based on identifying individuals. Some records with same unique id have different dates.
Could I identify the record with the unique id that has the earliest date by creating a flag variable with 0 (for no) and 1 (for yes) values?
sample code below:
data have;
input recordID uniqueid date:ddmmyy10.;
format date ddmmyy10.;
datalines;
1234625 55 08/03/2006
1234632 72 06/03/2005
1234634 8 11/11/1997
1234636 104 09/03/2007
1234650 88 12/10/1999
1234617 55 05/12/2000
;
run;
data want;
input recordID uniqueid date:ddmmyy10. flag;
format date ddmmyy10.;
datalines;
1234625 55 08/03/2006 0
1234632 72 06/03/2005 0
1234634 8 11/11/1997 0
1234636 104 09/03/2007 0
1234650 88 12/10/1999 0
1234617 55 05/12/2000 1
;
run;
Thank you!