How can the text input date of format 2011-01-01 be converted to a mmddyy10. format?
I am not 100% what you need, so maybe you find this helpful:
data _null_;
a='2011-01-01';
b=input(a,yymmdd10.);
format b mmddyy10.;
put 'new format=' b;
run;
Haikuo
I am not 100% what you need, so maybe you find this helpful:
data _null_;
a='2011-01-01';
b=input(a,yymmdd10.);
format b mmddyy10.;
put 'new format=' b;
run;
Haikuo
Hi Haikuo,
This is exactly what I needed... I could swear I have tried this, but kept receiving the "Invalid argument to function INPUT" error message.
data begin;
input date $25.;
cards;
2011-01-01
2011-01-02
;
run;
data test (drop=date);
set begin;
date2=input(date,yymmdd10.);
format date2 mmddyy10.;
put 'new format=' date2;
run;
LOG:
new format=01/01/2011
new format=01/02/201
Thanks!
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.