SAS Data Management

SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop, SAS Data Preparation and others
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
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-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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
  • 10115 views
  • 0 likes
  • 2 in conversation