Hi
I have got two questions, below is my data code.
data input;
input Account Name$ birthday: ddmmyy10. startdate: ddmmyy10. enddate: ddmmyy10. service_req;
format birthday: ddmmyy10. startdate: ddmmyy10. enddate: ddmmyy10.;
datalines;
1232 Ryan 01/01/1990 07/04/2017 01/03/2022 9356
1232 Ryan 01/01/1990 02/03/2022 27/08/2022 9667
1440 Chris 13/12/1987 11/03/2019 19/03/2022 5112
1440 Chris 11/12/1987 01/04/2022 30/12/9999 7891
1211 May 05/04/1998 13/09/2017 11/08/2022 1209
1265 Sandy 10/12/1988 12/08/2022 01/10/2022 1287
;
It will be great if someone can help me out, as I'm new to SAS. Please break down to one code per question instead of combine the code to answer both question, if its possible.
1. Typo on Chris's birthday, account 1440 for Chris, one entry of the birthday is 13/12/1987, the other one is 11/12/1987. We believe the latest service request provides the correct date of birth
Account | Name | birthday |
1232 | Ryan | 1/01/1990 |
1440 | Chris | 11/12/1987 |
1211 | May | 5/04/1998 |
1265 | Sandy | 10/12/1988 |
2. I want the latest service request if there is dup under the same ID and same name. In this scenario I want 9667 for Ryan's service request. And 7891 for Chris.
Account | Name | service_req |
1232 | Ryan | 9667 |
1440 | Chris | 7891 |
1211 | May | 1209 |
1265 | Sandy | 1287 |
Many thanks!