Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
First of all, there are some functions to use with dates, such as Age() that returns the number in years between two dates and Class() that returns the classification of a value regarding the parameters passed. It would be useful if you told us what do you want to get based on yoru EFFDATE field. What does those "-" signs in your script mean? Are they there on purpose?
Regards.
BI Consultant
hello,
well, EFFDATE field means the effective date and "-" is a substraction ,our purpose in this function is to get the age brackets field for example the field is : age bracket and the values are : 0-17 ,18-35 ... so in this function we substract EFFDATE or the effective date from the DOB witch means the date of birth
to get the age brackets.
regards.
Hi,
Check the following and adapt it to your own data and field names
Data:
LOAD Date(EFFDATE) AS EFFDATE,
Date(Date#(DOB, 'DDMMMYYYY')) AS DOB,
Age(Date(EFFDATE), Date(Date#(DOB, 'DDMMMYYYY'))) AS AGE,
If(Age(Date(EFFDATE), Date(Date#(DOB, 'DDMMMYYYY'))) <= 60, '<=60', If(Age(Date(EFFDATE), Date(Date#(DOB, 'DDMMMYYYY'))) > 65, '66-Above', '61-65')) AS AgeGroup
INLINE [
EFFDATE, DOB
1/5/2010, 10ENE1970
1/5/2010, 20JUN1988
1/5/2010, 23MAY1975
1/5/2010, 03AGO1978
1/5/2010, 03AGO1918
1/5/2010, 03AGO1944
];
Although this is loading INLINE (hardcoded values) you can use any other source.
Hope that helps.
BI Consultant