DATA Step, Macro, Functions and more

SAS DATETIME Conversion

Accepted Solution Solved
Reply
Contributor CEG
Contributor
Posts: 25
Accepted Solution

SAS DATETIME Conversion

Hi,

 

I'd like to get the numeric version of '31DEC16:00:00:00'

 

I tried:

 

options yearcutoff=1950;

data null;

a='31DEC16:00:00:00'd;

put 'SAS datetime='a;

put 'formatted datetime='a datetime18.;

run;

 

That gave me 20819 and 01JAN60:05:46:59

 

Thanks.


Accepted Solutions
Solution
‎01-31-2017 12:08 PM
Trusted Advisor
Posts: 1,375

Re: SAS DATETIME Conversion

As you are dealing with Datetime - you need define:

   a='31DEC16:00:00:00'dt;     ( instead   a='31DEC16:00:00:00'd; )

 

 

View solution in original post


All Replies
Solution
‎01-31-2017 12:08 PM
Trusted Advisor
Posts: 1,375

Re: SAS DATETIME Conversion

As you are dealing with Datetime - you need define:

   a='31DEC16:00:00:00'dt;     ( instead   a='31DEC16:00:00:00'd; )

 

 

Contributor CEG
Contributor
Posts: 25

Re: SAS DATETIME Conversion

Thanks for the quick response!

 

I left out the 't'.

☑ This topic is SOLVED.

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

Discussion stats
  • 2 replies
  • 102 views
  • 1 like
  • 2 in conversation