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

Dear all.

I-m very newbie to sas and I`m getting crazy with a simple problem.

I have a variable in a dataset $25. that contains a date like 18MAR2014:11:19:42

I want to convert it in a iso8601dt format...

Using

put _datetime is8601dt.;

I get in log

put _datetime is8601dt.;

                    ---------

                    48

ERROR 48-59: The format $IS8601DT was not found or could not be loaded.

Could you please help me?

SAS 9.3

Thank you

KR

1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Well, its a process of reading the string in as the nearest date/time format, then just apply a format:

data a;

  a="18MAR2014:11:19:42";

  b=input(a,datetime19.);

  format b e8601dt.;

run;

View solution in original post

5 REPLIES 5
Lorenzom
Calcite | Level 5

Thank you Loko,

but i cannot find any example to convert string into iso format.

Could you please provide an example to convert String in to iso8601...

I can also use date and time variables to convert into iso8601...


Thank you!

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Well, its a process of reading the string in as the nearest date/time format, then just apply a format:

data a;

  a="18MAR2014:11:19:42";

  b=input(a,datetime19.);

  format b e8601dt.;

run;

Loko
Barite | Level 11

As RW9 stated - you just have to choose the appropriate format (you can find them at the link mentioned in my previous post). Ther is no format named iso860 within SAS .

Lorenzom
Calcite | Level 5

thank you everybody.

it works!!

Thanks RW9 for the working example

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 6126 views
  • 3 likes
  • 3 in conversation