Hello everyone,
So, I have these two datasets as below-
data test1;
input ssn loanNO effDate ddmmyy10. program $ ;
cards;
1234 1 01/01/2013 no
1234 2 01/05/2013 no
1234 3 01/01/2014 yes
5678 1 01/01/2012 no
9101 1 01/05/2014 yes
9101 2 01/09/2013 no
;
run;
data test2;
input ssn fico date ddmmyy10. ;
cards;
1234 600 01/02/2012
1234 580 01/05/2012
1234 700 01/08/2012
1234 680 01/11/2012
1234 500 01/02/2013
1234 580 01/05/2013
1234 700 01/08/2013
1234 680 01/11/2013
1234 600 01/02/2014
1234 580 01/05/2014
1234 600 01/08/2014
1234 690 01/11/2014
;
run;
I need to join only those records from first datset test1 where program is yes and then get corresponding fico scores for that person for that year, previous year and following year. So, for example, for ssn 1234, yes was for 1 jan 2014 and the fico score during that period was 680 (fico scores are for 4 periods for each year, feb, may, aug and nov and in case we are looking for month other than these 4 months, we use the previous one-for ex, in this case nov 2013 was the last one, so we use that). Similarly fico score for previous year during that period was also 680 for nov 2012 and for following year we use nov 2014 which was 690.
Thanks a lot in advance.
... View more