Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to handle DB2 Timestamp?

Status
Not open for further replies.

srtor

Programmer
Feb 2, 2008
1
I am new to sas programming. How to handle db2 timestamp in a sas variable? I am running in batch mode (AIX, sas).
 
Can you give an example of what the DB2 timestamp looks like and what you mean by "handle" it.
If you're trying to read it in to be a SAS date, most databases use the format which SAS calls "DATETIME20." (I don't know DB2 specifically though). If you are reading in the data from a text file you can specify the informat for the field:-
Code:
  informat <fieldname> DATETIME20.;
then do your input statement. If you want the date part of it separated out from the time, then you can use the DATEPART() function:-
Code:
  newfield = datepart(<fieldname>);

I hope this helps.


Chris
Business Analyst, Code Monkey, Data Wrangler.
SAS Guru.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top