1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
*(Q) I have a date (begdate) and add 60 days to it. 
* How can I select the last day of the resulting month? 

*(A) Posted to SPSSX-L list by Raynald Levesque on 2003/08/14.

DATA LIST FIXED /begdate(ADATE10).
BEGIN DATA
7/10/2003
7/1/2003
2/28/2003
END DATA.

COMPUTE beg60 	= begdate + TIME.DAYS(60).
COMPUTE mth 	= XDATE.MONTH(beg60) + 1.
COMPUTE yr 		= XDATE.YEAR(beg60).
COMPUTE enddate 	= DATE.DMY(0,mth,yr).

FORMATS begdate beg60 enddate (DATE11).
VARIABLE WIDTH begdate beg60 enddate(11).
EXECUTE.