LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (March 2006, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 17 Mar 2006 08:59:09 -0600
Reply-To:     Jiann-Shiun Huang <Jiann-Shiun.Huang@AMERUS.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Jiann-Shiun Huang <Jiann-Shiun.Huang@AMERUS.COM>
Subject:      Re: Date Formats
Comments: To: BarberD@GMAIL.COM
Content-Type: text/plain; charset=US-ASCII

The_Grudge:

I am not sure about your second question. Try the following for the first. There is a dataset generated for the conversion of datetime to date value. The output follows the code.

data temp; input ADateTime:datetime18. ADate:date11.; format ADate yymmn4.; datalines; 01MAR1932:00:00:00 01-Mar-2010 ; run;

data Result(drop=ADateTime); set temp; DateOnly=int(ADateTime/(24*60*60)); format DateOnly yymmddn8.; run;

proc print data=Result;

run;

***** Output ***** The SAS System 08:07 Friday, March 17, 2006 58

Obs ADate DateOnly

1 1003 19320301

J S Huang 1-515-557-3987 fax 1-515-557-2422

>>> The_Grudge <BarberD@GMAIL.COM> 3/17/2006 8:35:02 AM >>> Hi again everybody.

I have 2 dates in a SAS table. They look like this...

1) 01MAR1932:00:00:00 2) 01-Mar-2010

I would like to convert the first date to YYYYMMDD or 19320301 and I would like to convert the second date to yymm or 1003.

Also, can I apply these formats to my "PUT" statement that produces the output file, or do I need to format the variables before this point?

So far my PUT looks like this...

Put IPOP $1. Cr_Number $7. LastName $25. FirstName $15. Birthdate $8. ;


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