Hello,
I have a data like:
date = 20200124 the format is NUM 8 YYMMDDN8.
I am trying to convert the date's type as CHAR 8. as requested.
I am using
new_date = put(date yymmdddn8.)
;
It shows 21938
Is that anyway can show the new_date as 20200124?
Thank you very much!
You missed a comma and you used an invalid format name.
new_date = put(date, yymmddn8.)
Works for me.
data have;
date='24JAN2020'd;
format date yymmddn8.;
run;
data want;
set have;
new_date=put(date,yymmddn8.);
run;
It should :
new_date = put(date, yymmdddn8.);
Your format has too many d's. It needs two not three ds.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.