DATA Step, Macro, Functions and more

DDMMMMYYYY

Accepted Solution Solved
Reply
Contributor
Posts: 21
Accepted Solution

DDMMMMYYYY

Good Afternoon

Im wondering if there is any way to convert a Text date that looks like 02JAN2017

 

Since im simply reading a dataset that has the date stored in this manor, im extracting it using a select statement, if at possible to convert or substring it from there and convert it, would be Best for me newbie self Smiley Happy

 

 

any help is greatly appreciated

 

happy friday!


Accepted Solutions
Solution
‎11-17-2017 02:59 PM
Super User
Posts: 12,994

Re: DDMMMMYYYY

Posted in reply to Bellefeuille

In a data step, since you have already read the data:

 

SASDate = input(yourdate, date9.);

format SASdate date9. ; /* or any of the other date formats humans like*/

 

in sql it would be

 

input(yourdate,date9.) as SASDate format=date9.

 

Best would be to read the data initially.

View solution in original post


All Replies
Solution
‎11-17-2017 02:59 PM
Super User
Posts: 12,994

Re: DDMMMMYYYY

Posted in reply to Bellefeuille

In a data step, since you have already read the data:

 

SASDate = input(yourdate, date9.);

format SASdate date9. ; /* or any of the other date formats humans like*/

 

in sql it would be

 

input(yourdate,date9.) as SASDate format=date9.

 

Best would be to read the data initially.

☑ This topic is solved.

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

Discussion stats
  • 1 reply
  • 102 views
  • 0 likes
  • 2 in conversation