Page 1 of 1

Calculate Age

Posted: April 28th, 2015, 1:33 am
by lb.fam
Attempting to calculate the age based on dates which have been entered by a user using the date picker.

The items are 8 character numeric and reside within different records.

The calculation is carried out within a roster.


PROC AGE

preproc
$ = datediff(DATEOFBIRTH(currIdx),INTERVIEWDATE(currIdx),"y");

When I run this code the age field remains blank. Any idea how to resolve?

Re: Calculate Age

Posted: April 28th, 2015, 10:56 am
by josh
Make sure that you have the date format set to YYYYMMDD in the field properties for both date fields. Datediff only works if values are in this format.

Re: Calculate Age

Posted: May 8th, 2015, 4:06 am
by lb.fam
That worked (I had ddmmyyy format).

Thanks.