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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.