I need to convert date character $CHAR6. to date DATE9.
for example EDATE is a var I have, FDATE is a var I want:
$CHAR6. DATE9.
EDATE FDATE
201001 01JAN2010
201612 01DEC2016
201306 01JUN2013
fdate = input(trim(edate)!!'01,yymmdd8.);
format fdate date9.;
Use code:
Fdate = put(input(Edate||'01',yymmdd8.),date9.);
thank you Shmuel that works, but var Fdate finished like type character6, I need not only format DATE9. too the var I need same type
Your post didn't ask for numeric date.
Anyhow, see @Kurt_Bremser solution, it fits your request.
fdate = input(trim(edate)!!'01,yymmdd8.);
format fdate date9.;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.