Fields in a smart date format can easily be compared to identify the number of days lapsed between the two points in time. In the example below, a temporary field is created to determine the age of an employee at the time of their retirement. The new field, AGE, is created by subtracting the employee's birth date from the effective date of their retirement and dividing the resulting number of days by 365.
Example using the COMPUTE command:
EX SP
TABLE FILE SP
PRINT SP:WNAME
COMPUTE AGE/I5 = (SP:EFFDATE-SP:BRTHDATE)/365;
WHERE SP:TRANCODE EQ 'S70' OR 'S71'
END
Related Topic: Smart Dates