04-29-2015 09:43 AM
I have a character variable (DateVar) which I want to convert to date.
The output dataset should also show the value of DateVar as November 2014 but as a date variable.
04-29-2015 10:06 AM
I'd split the string with SCAN and then use the FINDW function to determine the month out of a reference string.
I doubt that a single format could be made that handles the display in one step. You may have to create a separate character variable for display (or keep the original column).
04-29-2015 10:27 AM
If you need the display to look like this I would keep this column as your display, you can use substr() to cut up the format and then go with the MONYY. format for any calculations that need done.
04-29-2015 10:34 AM
month = substr(datevar,1,3);
year = scan(datevar,2,' ');
format new_date monyy7.;
new_date = input(put(trim(month)||trim(year),$char7.),monyy7.);