|Date: ||Fri, 2 Jun 2000 17:46:03 -0400|
|Reply-To: ||Mike Rhoads <RHOADSM1@WESTAT.COM>|
|Sender: ||"SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>|
|From: ||Mike Rhoads <RHOADSM1@WESTAT.COM>|
|Subject: ||Re: SAS/Base: Date Format dd-mmm-yyyyy|
|Content-Type: ||text/plain; charset="iso-8859-1"|
Version 8 of SAS provides a nice set of "date directives" that can be used
in the PICTURE statement of PROC FORMAT to get a wide variety of date output
formats. The following produces pretty much what you want, albeit with the
month name in all caps. Replace the 0D with just D in the format value if
you don't want leading zeroes for the first 9 days of the month. As always,
RTFM for further details.
14 PROC FORMAT;
15 PICTURE MyDateP
16 LOW-HIGH='%0d-%b-%Y' (DATATYPE=DATE);
NOTE: Format MYDATEP is already on the library.
NOTE: Format MYDATEP has been output.
NOTE: PROCEDURE FORMAT used:
real time 0.04 seconds
18 DATA _NULL_;
19 D = '15JAN2000'd;
20 put D MyDateP11.;
> -----Original Message-----
> From: Bill Knowlton [mailto:Bill_Knowlton@BAXTER.COM]
> Sent: Friday, June 02, 2000 4:01 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: SAS/Base: Date Format dd-mmm-yyyyy
> Is anyone privy to a SAS date format that can display dates
> as dd-mmm-yyyy,
> where mmm is the alphabetic month (e.g. Apr, Aug) and the
> separators are
> dashes. Example resolution: 17-Jan-2000.
> I've cobbled together this monster for getting the look, but
> I loose the
> date's chronology functionality on converting to character:
> data X ;
> length TESTDATE 4 CD1 $9 CD2 $11 ;
> TESTDATE = input('15JAN2000',date9.) ;
> CD1 = put(TESTDATE, date9.) ;
> CD2 = substr(CD1,1,
> 2)||"-"||substr(CD1,3,3)||"-"||substr(CD1,6,4) ;
> run ;
> , plus this is not very appealing.
> Thanks for any insights.