Date: Wed, 11 Mar 2009 12:07:52 -0400
Reply-To: ed@heaton.name
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Ed Heaton <ed@HEATON.NAME>
Subject: Re: Convert Character Date/Time to Text Date/Time
In-Reply-To: <35b112db-7790-4c92-9200-466fbacf82c2@v5g2000prm.googlegroups.com>
Content-Type: text/plain; charset="iso-8859-1"
Piece of cake:
Data _null_ ;
order_time = "2001-04-20 14:30:00" ;
Format Date date9. Time time. ;
Date = input( scan( order_time , 1 , " " ) , yymmdd10. ) ;
Time = input( scan( order_time , 2 , " " ) , time8. ) ;
Put _all_ ;
Run ;
Ed
Ed Heaton
10318 Yearling Drive
Rockville, MD 20850-3517
Voice: (301) 424-8186
Mobile: (301) 520-7414
Fax: (301) 424-8187
Email: mailto:ed@heaton.name
URL: http://ed.heaton.name
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Mark Sussman
Sent: Wednesday, March 11, 2009 11:53 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: [SAS-L] Convert Character Date/Time to Text Date/Time
I have a column with date and time (order_time) that i would like to
separate out and create a numeric date and a numberic time out of it.
I have been able to split up the two using the SCAN function, but
cannot figure out how to convert the two columns into text:
Original Column: 2001-04-20 14:30:00
New Date Column: 2001-04-20 (char)
New Time Column: 14:30:00 (char)
|