DATA Step, Macro, Functions and more

date format tranformation please

Accepted Solution Solved
Reply
Contributor
Posts: 28
Accepted Solution

date format tranformation please

Hello,

 

How to convert the data in this format "15Jun2016 14:47:33" to "201606" ? Just want to keep the year and month like this.

 

Thanks

 


Accepted Solutions
Solution
‎03-31-2017 03:23 PM
PROC Star
Posts: 290

Re: date format tranformation please

It's not clear if you're referring to actual vs. formatted values, but it looks like you want to pull the date from the datetime value you have and just display it at 201606.

 

data _null_;
    dt = "15Jun2016 14:47:33"dt;
    date = datepart(dt);
    put date yymmn.;
run;

View solution in original post


All Replies
Solution
‎03-31-2017 03:23 PM
PROC Star
Posts: 290

Re: date format tranformation please

It's not clear if you're referring to actual vs. formatted values, but it looks like you want to pull the date from the datetime value you have and just display it at 201606.

 

data _null_;
    dt = "15Jun2016 14:47:33"dt;
    date = datepart(dt);
    put date yymmn.;
run;
Contributor
Posts: 28

Re: date format tranformation please

THANKS
☑ This topic is solved.

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

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