LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (June 2000, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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
Comments:   To: Bill Knowlton <Bill_Knowlton@BAXTER.COM>
Content-Type:   text/plain; charset="iso-8859-1"

Bill,

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. 17

NOTE: PROCEDURE FORMAT used: real time 0.04 seconds

18 DATA _NULL_; 19 D = '15JAN2000'd; 20 put D MyDateP11.; 21 RUN;

15-JAN-2000

Mike Rhoads Westat RhoadsM1@Westat.com

> -----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. > > -Bill >


Back to: Top of message | Previous page | Main SAS-L page