Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Compute dates

0 views
Skip to first unread message

Alicia Booth

unread,
Mar 3, 1998, 3:00:00 AM3/3/98
to

I have a date variable and I need to compute another variable in which the
month and day are the same but the year is one year later. I could try
extracting month, day and year using the 'xdate.month(date),
xdate.mday(date), xdate.year(date)' functions, but this would be very time
consuming because I need to process many dates in the same fashion. Besides
I would be left with the dates split in three numeric fields and I need it
in date format. Is there a simple way of doing what I need to do?

I have this '02/03/98' and

I need this '02/03/99'

I would appreciate it if you could respond to me directly since right now I
am not a member of the List Serve. Thank you in advance for your help.

Alicia Booth

David Mark Marso

unread,
Mar 3, 1998, 3:00:00 AM3/3/98
to Alicia Booth

* Add one year to a date * .
DATA LIST / date1 1-10 (ADATE) date2 12-21 (ADATE).
BEGIN DATA
02/09/1997 03/09/1996
12/09/1997 05/21/1996
END DATA .

DO REPEAT NEWDATE=NDATE1 NDATE2 / OLDDATE=date1 date2.
COMPUTE NEWDATE=DATE.MDY(XDATE.MONTH(olddate),
XDATE.MDAY(olddate),
XDATE.YEAR(olddate)+1).
FORMATS NEWDATE (ADATE10).
END REPEAT.
LIST.

David Marso

0 new messages