I used the 'age' function which will return a value between a dob and current date. The format of the value is yymmdd. I can see the age in years is correct and I want to pull that out so I have a two digit age. If I use the 'years between' to calculate, the ages are incorrect by one year (most of them).
How do I pull out just the years?
Any ideas?
Thanks!!
Hi,
Try using this expression to pull out just the years.
cast( ([Data Item]/10000), integer)
Assuming the date range returned is either a 6 digit number or a 5 digit number... This should return only the quotient value which would be the number of years...
P.S: I tried to find any difference between the years obtained using age and years_between and i cudnt find one... Can you please post some sample DOB values for which these values differ?
Hi,
You can also try using this expression
(integer(substr(char(_age(Patient Date of Birth)),1,4)))
This will first give you the age.Then to get the first two digit from the age you need to use 'substr' function.