07-25-2013 12:40 PM
I have a variable(DC_Date as MM/DD/YYYY) and I have one year worth of data(May2012-Apr2013). I want to create a new variable which gives date in month and year format(APR2013 .....May2012) and I want to sort them is in such a way that APR2013 ,MAR2013,FEB2013,JAN2013,DEC2012.....MAY2012. or APR2013 being the first month and May2012 being the last month. I am wondering if there is a way to do that.
07-25-2013 12:44 PM
I don't think you have to create a new variable just to apply a different format. If you really need to create one....
create table new as
intnx('month',dc_date,0,'begin') format=monyy7. as NewDate
from old t1
order by intnx('month',dc_date,0,'begin') desc;