08-11-2014 04:21 AM
Could you please suggest or advice on how to do the Custom Format of a Date using the "Format" Operator option on 'New Calculated Item'
My Date from the data set is stored with the Format of "DD-MON-YYYY". The Expected Format is "Jan'19" (MMM'YY)
Thanks in advance.
08-11-2014 12:15 PM
Do you really want an apostrophe in the date display?
proc format library=work;
picture odddate (default=6)
low-high = '%b''%y' (datatype=date);
put x= odddate.;
08-13-2014 10:58 AM
The low-high signals the range of values to be formatted as directed meaning the lowest value and largest value possible in SAS. A tad of overkill but since I have no idea of specific date ranges then simplest is to use all of the available values. Actually dates before some date in the year 1585 if I remember correctly won't format as a valid date. The other parts the value to display is in quotes, the %b and %y are called directives and when used with a datatype of date and for use displaying parts of the date in requested formats, look in the online help under PICTURE for formats for a complete list, %b, and lower case is needed, gets the abbreviated month name and %y gets the 2-digit year, the two single quotes are one of SAS's way of saying display one single quote as a single quote in this position would terminate the statement prematurely and result in a syntax error.
08-13-2014 08:21 AM
Are you using SAS VA. If yes, then look at the date data item, select it then you will see format below, from there you could select any of the available format which best satisfies your requirements. Large manipulations can also be done using those format options which doesn't exist in data source!cheers!