Date: Tue, 19 Aug 2008 00:50:40 -0400
Reply-To: Scott Bass <sas_l_739@YAHOO.COM.AU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Scott Bass <sas_l_739@YAHOO.COM.AU>
Subject: Picture format to print Mon-Yy
Hi,
We've got an existing ETL application storing month strings as character
data, i.e. Jan-08, Feb-08, etc.
Of course, if I sort on that column, it doesn't sort correctly.
I'd prefer to store the data as a SAS date value, but need to redisplay it
back as Mon-Yy, i.e. Jan-08, Feb-08, etc.
Here is my working code:
proc format;
picture foo
low-high = '%b-%0y' (datatype=date)
;
run;
data _null_;
date_chr="Feb-08";
date_num=input(date_chr,monyy6.);
put date_num foo.;
run;
This prints as FEB-08, but I need Feb-08 (pedantic, I know).
Is there a native format I'm unaware of that will print dates as desired?
Or an option to the picture format that will format the date as PROPCASE?
This is SAS 9.1.3 SP4 on Windows.
Thanks,
Scott
|