03-10-2015 09:24 PM
Hi everyone, hoping someone could assist me with a SAS statement to produce an output I'm after.
I have two separate datasets as below:
ABC Jan 2012
ABC Aug 2012
ABC Jul 2014
ABC Sep 2012
ABC Sep 2013
ABC Sep 2014
For this policy, I'm trying to group the ClaimDate into the RenewalDate. For example, if the claim is pre Sep 2012, I would like to group it into Sep 2012. If the claim is between Oct 2012 and Sep 2013, I would like to group it into Sep 2013.. and so forth.
The final output would be something like this:
Policy ClaimDate RenewalDate
ABC Jan 2012 Sep 2012
ABC Aug 2012 Sep 2012
ABC Jul 2014 Sep 2014
Thanks in advance!
03-11-2015 09:37 AM
Your rules needs to more specific given your example, what happens when both Aug2012 and Jan2012 is prior to Sep2012 in both rows? what happens to Sep 2013 renewaldate? How do you determine which goes to which?
03-11-2015 12:10 PM
Sounds like you the September that's in the future.
Assuming SAS Dates, since you haven't specified, something like the following:
*claimDate=input(claim_date, yearmon7.); *if claim_date is a character variable can be converted using the input function;
if month(claimDate)<=9 then RenewalDate=mdy(9,1, year(claimDate));
else RenewalDate=mdy(9,1, year(claimDate)+1);
Format renewalDate monyy7.;