How to: |
Available Languages: reporting, Maintain
The AYMD function adds days to or subtracts days from a date in year-month-day format. You can convert a date to this format using the CHGDAT or EDIT function.
AYMD(indate, days, output)
where:
I6, I6YMD, I8, I8YYMD
Is the legacy date in year-month-day format. If the date is not valid, the function returns the value 0 (zero).
Integer
Is the number of days you are adding to or subtracting from indate. To subtract days, use a negative number.
I6, I6YMD, I8, or I8YYMD
Is the name of the field that contains the result, or the format of the output value enclosed in single quotation marks. If indate is a field, output must have the same format.
If the addition or subtraction of days crosses forward or backward into another century, the century digits of the output year are adjusted.
AYMD adds 35 days to each value in the HIRE_DATE field, and stores the result in AFTER35DAYS:
TABLE FILE EMPLOYEE PRINT HIRE_DATE AND COMPUTE AFTER35DAYS/I6YMD = AYMD(HIRE_DATE, 35, AFTER35DAYS); BY LAST_NAME BY FIRST_NAME WHERE DEPARTMENT EQ 'PRODUCTION'; END
The output is:
LAST_NAME FIRST_NAME HIRE_DATE AFTER35DAYS --------- ---------- --------- ----------- BANNING JOHN 82/08/01 82/09/05 IRVING JOAN 82/01/04 82/02/08 MCKNIGHT ROGER 82/02/02 82/03/09 ROMANS ANTHONY 82/07/01 82/08/05 SMITH RICHARD 82/01/04 82/02/08 STEVENS ALFRED 80/06/02 80/07/07