data list free /datevar (date11).
begin data
28-OCT-2006
end data.
*same internal value, different display format.
compute newdate1=datevar.
formats newdate1 (moyr9).
*internally, the first day of the month.
compute newdate2=date.moyr(xdate.month(datevar), xdate.year(datevar)).
formats newdate2(moyr9).
-----Original Message-----
From: SPSSX(r) Discussion [mailto:
[hidden email]] On Behalf Of Nico Peruzzi
Sent: Friday, October 27, 2006 11:36 AM
To:
[hidden email]
Subject: recode DD-MMM-YY to MMM-YY
I have a date variable in the format DD-MMM-YY and I want to ignore the day and recode it to MMM-YY.
For example, both 12-JAN-2006 and 30-JAN-2006 would be recoded into JAN-2006 (or 01-JAN-2006 would be fine too).
Xdate.Month isn't quite right. It's as though I need something like Xdate.MonthYear.
Thanks in advance for any tips, Nico
--
Nico Peruzzi, Ph.D.