Desktop productivity for business analysts and programmers

Converting Dates SAS PROC SQL

Accepted Solution Solved
Reply
Contributor
Posts: 26
Accepted Solution

Converting Dates SAS PROC SQL

Hi - PLEASE HELP!

 

my Date1 column is in the following format "2012-01-25 12:44:44.0" - [ FORMAT $28 ]

 

 

and I need to convert it to 25JAN2012:00:00:00 - [ FORMAT DATETIME20]

 

THANK You!!!!


Accepted Solutions
Solution
‎09-23-2016 04:08 PM
Super User
Posts: 11,134

Re: Converting Dates SAS PROC SQL

input(date1,anydtdtm32.) as DatetimeVar format=datetime20.

 

 

View solution in original post


All Replies
Frequent Contributor
Posts: 123

Re: Converting Dates SAS PROC SQL

[ Edited ]

You will need to do something like this:

 

 

PROC SQL;
  CREATE TABLE Want AS
  SELECT PUT(datepart(Date1),DATETIME20.) as Date1
  FROM have;
QUIT;

 

Solution
‎09-23-2016 04:08 PM
Super User
Posts: 11,134

Re: Converting Dates SAS PROC SQL

input(date1,anydtdtm32.) as DatetimeVar format=datetime20.

 

 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 330 views
  • 1 like
  • 3 in conversation