Discussion:
SAS Date Formats
(too old to reply)
Bosch, Jules
2005-01-14 21:21:58 UTC
Permalink
SAS V8.2

Is it possible to have the SAS date format DATE9. display as 14Jan2005
instead of 14JAN2006, i.e. upper case "J" and lower case "an"?

TIA,

Jules Bosch


*********************************************************************
This message and any attachments are solely for the intended recipient. If you are not the intended recipient, disclosure, copying, use or distribution of the information included in this message is prohibited -- Please immediately and permanently delete.
James, Steve
2005-01-14 23:00:04 UTC
Permalink
Jules,

I can't think of one. You can do it with data step variables pretty
easily like so:

today = today() ;
date = put(today,date9.) ;
substr(date,4,2)=lowcase(substr(date,4,2)) ;

but that's probably not what you were looking for. I'll be interested
to see if someone else has any ideas.

Steve

Steve James
Centers for Disease Control and Prevention
***@cdc.gov

-----Original Message-----
From: Bosch, Jules [mailto:***@SPCORP.COM]
Sent: Friday, January 14, 2005 4:22 PM
Subject: SAS Date Formats

SAS V8.2

Is it possible to have the SAS date format DATE9. display as 14Jan2005
instead of 14JAN2006, i.e. upper case "J" and lower case "an"?

TIA,

Jules Bosch


*********************************************************************
This message and any attachments are solely for the intended recipient.
If you are not the intended recipient, disclosure, copying, use or
distribution of the information included in this message is prohibited
-- Please immediately and permanently delete.
Jack Hamilton
2005-01-14 23:31:39 UTC
Permalink
You could use WORDDATX12, which would display

14 Jan 2004

SAS correctly interprets the constant '14 Jan 2004'd as a date.

Unfortunately, there's no date picture directive for lowercase month
name.

The easiest way for SAS to support this, I think, would be to add an
English_UpperLower National Language locale, but as far as I can tell
they haven't. The documentation is, for me, somewhat hard to follow.





--
***@FirstHealth.com
Manager, Technical Development
Metrics Department, First Health
West Sacramento, California USA

Coelum, non animum mutant, qui trans mare currunt.
SAS V8.2

Is it possible to have the SAS date format DATE9. display as 14Jan2005
instead of 14JAN2006, i.e. upper case "J" and lower case "an"?

TIA,

Jules Bosch


*********************************************************************
This message and any attachments are solely for the intended recipient.
If you are not the intended recipient, disclosure, copying, use or
distribution of the information included in this message is prohibited
-- Please immediately and permanently delete.


"MMS <firsthealth.com>" made the following annotations.
------------------------------------------------------------------------------
This message, including any attachments, is intended solely for the use
of the named recipient(s) and may contain confidential and/or
privileged information. Any unauthorized review, use, disclosure or
distribution of this communication(s) is expressly prohibited.
If you are not the intended recipient, please contact the sender by
reply e-mail and destroy any and all copies of the original message.
Thank you.
==============================================================================
toby dunn
2005-01-15 03:28:44 UTC
Permalink
Jack,

One would have to wonder if careful use of propcase function would do the
job. As I only have v9 I can't test this idea out.



Toby Dunn




From: Jack Hamilton <***@FIRSTHEALTH.COM>
Reply-To: Jack Hamilton <***@FIRSTHEALTH.COM>
To: SAS-***@LISTSERV.UGA.EDU
Subject: Re: SAS Date Formats
Date: Fri, 14 Jan 2005 16:31:39 -0700


You could use WORDDATX12, which would display

14 Jan 2004

SAS correctly interprets the constant '14 Jan 2004'd as a date.

Unfortunately, there's no date picture directive for lowercase month
name.

The easiest way for SAS to support this, I think, would be to add an
English_UpperLower National Language locale, but as far as I can tell
they haven't. The documentation is, for me, somewhat hard to follow.





--
***@FirstHealth.com
Manager, Technical Development
Metrics Department, First Health
West Sacramento, California USA

Coelum, non animum mutant, qui trans mare currunt.
SAS V8.2

Is it possible to have the SAS date format DATE9. display as 14Jan2005
instead of 14JAN2006, i.e. upper case "J" and lower case "an"?

TIA,

Jules Bosch


*********************************************************************
This message and any attachments are solely for the intended recipient.
If you are not the intended recipient, disclosure, copying, use or
distribution of the information included in this message is prohibited
-- Please immediately and permanently delete.


"MMS <firsthealth.com>" made the following annotations.
------------------------------------------------------------------------------
This message, including any attachments, is intended solely for the use
of the named recipient(s) and may contain confidential and/or
privileged information. Any unauthorized review, use, disclosure or
distribution of this communication(s) is expressly prohibited.
If you are not the intended recipient, please contact the sender by
reply e-mail and destroy any and all copies of the original message.
Thank you.
==============================================================================
Chang Y. Chung
2005-01-15 03:30:01 UTC
Permalink
Post by Bosch, Jules
SAS V8.2
Is it possible to have the SAS date format DATE9. display as 14Jan2005
instead of 14JAN2006, i.e. upper case "J" and lower case "an"?
Hi, Jules,

If you have limited date range, then why not create your own format like
below? :-)

Cheers,
Chang

/* this date format works from 01jan2000 to 31dec2100 */
data myDate;
retain fmtname 'MyDate';
do start = '01jan2000'd to '31dec2100'd;
label = put(start, date9.);
substr(label, 4, 2)=lowcase(substr(label, 4, 2));
output;
end;
hlo="O";
label = "out range";
output;
run;
proc format cntlin=myDate;
run;

/* test */
data _null_;
today = today();
put today :MyDate9.;
run;
/* on log
14Jan2005
*/
Bosch, Jules
2005-01-17 15:22:28 UTC
Permalink
The question I raised herein yielded a number of responses and my thanks to
all respondents.

I had already written a short program and PROC FORMAT to "fix" the dates as
required by the business unit. But, I was still interested in finding out
if there might be a SAS FORMAT that would simplify the problem.

Thanks again,

Jules Bosch

-----Original Message-----
From: Bosch, Jules [mailto:***@SPCORP.COM]
Sent: Friday, January 14, 2005 4:22 PM
To: SAS-***@LISTSERV.UGA.EDU
Subject: SAS Date Formats

SAS V8.2

Is it possible to have the SAS date format DATE9. display as 14Jan2005
instead of 14JAN2006, i.e. upper case "J" and lower case "an"?

TIA,

Jules Bosch


*********************************************************************
This message and any attachments are solely for the intended recipient. If
you are not the intended recipient, disclosure, copying, use or distribution
of the information included in this message is prohibited -- Please
immediately and permanently delete.



*********************************************************************
This message and any attachments are solely for the intended recipient. If you are not the intended recipient, disclosure, copying, use or distribution of the information included in this message is prohibited -- Please immediately and permanently delete.
Continue reading on narkive:
Loading...