I have a char date which is something like "17 Nov 2016" and i want to make it as "2016-11-17".
Tried A=INPUT(E,is8601da.);
But it didnt work as the input is char variable.
Any help?
Convert it to an actual date and then convert it back into a character string.
A=put(input(E,date11.),yymmdd10.);
Try next code:
sas_date = cats('"', input(compress(date_in), 'D"',date9.);
format sas_date yymmdd10.;
I get error while using
data ec;
6528
6529 dat="17 Nov 2016";
6530 sas_date = cats('"', input(compress(dat), 'D"',date9.);
----
85
76
ERROR 85-322: Expecting a format name.
ERROR 76-322: Syntax error, statement will be ignored.
Make it simpler:
sas_date = input(compress(date_in),date9.);
Convert it to an actual date and then convert it back into a character string.
A=put(input(E,date11.),yymmdd10.);
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.