BookmarkSubscribeRSS Feed
paddyb
Quartz | Level 8

trying to convert sdtm date into is8601dt format in adam,not working,what I am missing?

TR02SDTM=input(EXSTDTC,is8601dt.);

dt.png

9 REPLIES 9
paddyb
Quartz | Level 8
not working:(
paddyb
Quartz | Level 8

data exb1_;
24
25 set exb;
26 by usubjid;
27 if first.usubjid then do;
28 TR02SDT=input(EXSTDTC,e8601da.);
29
30 TR02SDTM=input(EXSTDTC,e8601dt.);
31 end;
32 if last.usubjid then do;
33 tr02edt=input(exendtc,e8601da.);
34 end;
35 format tr02sdtm e8601dt.;
36 format TR02SDT tr02edt e8601da.;
37 run;

NOTE: Invalid argument to function INPUT at line 30 column 13.

novinosrin
Tourmaline | Level 20

I dont think there is an is8601dt informat to convert to a date numeric variable before you apply is8601dt  format 

You prolly need E8601DTw.d informat . Correct me if i am wrong

ChrisHemedinger
Community Manager

I'm a little confused by your log and the format of the original values.  Doesn't something like this work?

 

data d;
 exstdtc = "2003-03-26T09:00";
 tr02sdtm = input (exstdtc,is8601dt.);
 format tr02sdtm is8601dt.;
run;
It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
SuryaKiran
Meteorite | Level 14

unexpected leading or trailing blanks maybe causing the missing values. use COMPRESS() and check.

data test;
var1='		2003-03-26T09:00';
var2='2003-03-26T09:00';
need1=input(var1,is8601dt.);
need2=input(var2,is8601dt.);
run;

Capture.PNG 

Thanks,
Suryakiran
paddyb
Quartz | Level 8

Thanks everyone.Problem was with blank space.

used tr02sdtm=input(strip(exstdtc),e8601dt.); and it worked

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
  • 9 replies
  • 8575 views
  • 2 likes
  • 5 in conversation