Date: Tue, 14 Sep 1999 10:22:00 -0400
Reply-To: Mark Jordan <mark.jordan@CAPITALONE.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Mark Jordan <mark.jordan@CAPITALONE.COM>
Subject: FW: DateTime to String
Content-Type: text/plain; charset="US-ASCII"
This should do it:
DATA mylib.NEWDATA;
SET mylib.DATA;
DROP DATE;
DATETIME = INPUT(PUT(DATE,DATETIME18.),$18.);
RUN;
Mark Jordan
Capital One Services, Inc.
Enterprise SAS Solutions
"Do witches run spell checkers?"
-----Original Message-----
From: Natalie Herbert <herbert@NOVAWEBGROUP.COM>
Sent: Tuesday, September 14, 1999 9:20 AM
To: SAS-L@VM.MARIST.EDU
Subject: DateTime to String
I think I have seen a post on this before, but I can't seem to find it......
I'm trying to take a SAS datetime field, and insert it into an RDBMS (Sybase).
The problem, is that SAS stores the Datetime field as a number, and in order to
insert it (using
PROC SQL), I need it as a string. So, if I have a dataset DATA with the
variable DATE, and want to
insert it into an SQL table TABLE with field DATETIME, I would have:
proc sql;
insert into mylib.TABLE (DATETIME)
select DATE from work.DATA;
run;
What I would like to do is take the dataset datetime variable, and create a new
databaset with a
string variable (with some format of the date and time that the SQL database
would accept).
Anyone have any ideas? I've tried a few format statements, but with no luck.
Natalie