Re: Date/time to date format in PROC SQL

  • Follow


The function DATEPART() does what its name implies; e.g., ...  DATEPART(B.DOB) as DOB format=mmddyy10. .... will yield a SAS date value formatted as specified and use the alias DOB to create a variable DOB in the yield of the query, TEST.
S

-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Craig Johnson
Sent: Tuesday, December 22, 2009 12:35 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Date/time to date format in PROC SQL

I'm pulling data from a database that is storing the date in a Date/Time
format.  I need to create a new dataset using a standard date format
(MM/DD/YYYY).  Is there a simple way to go from this 13JUL2006:00:00:00 to
this 07/13/2006 in PROC SQL?

Example Code I'm working with....

PROC SQL;
CREATE TABLE TEST AS
SELECT A.ID AS ID1, A.DOB AS DOB1, B.ID AS ID2, scan('B.DOB', -3, ':')
Format=mmddyy8. AS DOB2
FROM MDSVERI.Assessment1 AS A FULL JOIN ACCESS.Table1 AS B
ON A.ID = B.ID;
QUIT;

I'm sure there is a simple answer I'm just not sure what it is.....
thoughts?
0
Reply HERMANS1 12/22/2009 6:07:27 PM


0 Replies
315 Views

(page loaded in 0.008 seconds)

Similiar Articles:













7/25/2012 1:29:36 PM


Reply: