DATA Step, Macro, Functions and more

Multiple format in character date to mm/dd/yyyy format

Reply
Learner
Posts: 1

Multiple format in character date to mm/dd/yyyy format

Hello,

 

I have a character variable and it has two different formats for date:

 

2016-02-23

02/23/2016

 

How can I convert this inot single date format as 02/23/2016 for all the values. 

 

Thank you.

Respected Advisor
Posts: 3,156

Re: Multiple format in character date to mm/dd/yyyy format

Posted in reply to krishah_sas

If you only these two variations, then

data test;
input dt anydtdte20.;
format dt date9.;
cards;
2016-02-23
02/23/2016
;



Ask a Question
Discussion stats
  • 1 reply
  • 144 views
  • 0 likes
  • 2 in conversation