Discovering final date given an initial date and quantity of days

Hi! Is it possible to obtain the end date given a start date and a number of days? And vice versa: get a start date giving an end date and an amount of days?

PS: dates are in numeric format (N08) in this sequence YYYYMMDD.

EG: given an initial date 20220606, what’s the date after 100 days?

I just have no idea how to obtain this… If anyone can help me, I would be grateful!

Hi Priscilla,

Something like this:

DEFINE DATA LOCAL

1 DATE-N (N8)

1 REDEFINE DATE-N

2 DATE-A (A8)

1 DATE (D)

END-DEFINE

INPUT DATE-N

MOVE EDITED DATE-A TO DATE (EM=YYYYMMDD)

ADD 100 TO DATE

WRITE DATE (EM=DD/MM/YYYY)

END

1 Like

Priscilla,

You can MOVE EDITED your N8 to a variable define as a “date” – example: 1 #DATE (D) – then ADD 100 to #DATE and finally MOVE EDITED it to the end date

1 Like

P.S. You may have to either:

  1. REDEFINE N8 as A8 and MOVE EDITED A8 to Date

  2. MOVE N8 to A8 then MOVED edited A8 to Date

Then you can add 100 to date field and if you want move EDITED back….