07-26-2011 01:04 PM
I'm trying to get the difference in Years between two dates at the end of each month end date.
MembershipDate: which is a Datetime format and
I have a parameter I reference throughout my code to be the month end date:
%let cur_mth_end = '31Jan10'd.
I used the function
Tenure = Datdif (MembershipDate, &cur_mth_end, 'act/act') / 365 ;
but I get the note:
Invalid argument to function DatDif
I'm pretty sure its because MembershipDate is a datetime format, but not sure how to fix this.
Thanks for your help.
07-26-2011 01:10 PM
To convert a datetime to date use the datepart function.
You might want to look up the intck function which calculates some date difference and you can also customize the alignment in that function to 'end' of the month/year which seems what you're looking for.
Need further help from the community? Please ask a new question.