BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sasuser123123
Quartz | Level 8
Hello!
I've date 20120304 and time 09:30:00
I need to combine these two dates with is8601dt. format.

I'm using the below code.
Data new;
Set old;
NewDate=put(input(catch('T',date,time),b8601dt.),is8601dt.);
run;

While I'm running this code I got a error which shows invalid argument to input function

Could you please solve this query..

Thank you.
Regards
1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

See if this works for you

 

data test;
    date='20120304';
    time='09:30:00';
    datetime=dhms(input(date, yymmdd8.), 0, 0, input(time, time8.));
    format datetime is8601dt.;
run;

View solution in original post

6 REPLIES 6
PeterClemmensen
Tourmaline | Level 20

Are date and time numerical values? I.e. actual date/time values or character values?

 

sasuser123123
Quartz | Level 8
Both date and time variables are in character format
sasuser123123
Quartz | Level 8
I mean character values
PeterClemmensen
Tourmaline | Level 20

See if this works for you

 

data test;
    date='20120304';
    time='09:30:00';
    datetime=dhms(input(date, yymmdd8.), 0, 0, input(time, time8.));
    format datetime is8601dt.;
run;
sasuser123123
Quartz | Level 8
@PeterClemmensen
Thank you so much. It's perfectly working.

Thank you so much for your assistance.

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 6 replies
  • 9754 views
  • 0 likes
  • 2 in conversation