BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Angel_Saenz
Quartz | Level 8

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

1 ACCEPTED SOLUTION
5 REPLIES 5
Shmuel
Garnet | Level 18

Use code:

 

Fdate = put(input(Edate||'01',yymmdd8.),date9.);

Angel_Saenz
Quartz | Level 8

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

Shmuel
Garnet | Level 18

Your post didn't ask for numeric date.

Anyhow, see @Kurt_Bremser solution, it fits your request.

Peter_C
Rhodochrosite | Level 12
Have you tried the format hunter?

See the 2014 SAS Global Forum paper 1744-2014
VFORMAT Lets SAS® Do the Format Searching

It will hunt for informats too

Peter

sas-innovate-2024.png

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.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 1123 views
  • 1 like
  • 4 in conversation