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

data have;

a='10jan2012'd;

b='10:20:30't;

format a date9. b time8.;

run;

but i want output like this 10jan2012:10:20:30

how can i add two values?

Thanks in advance.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
data have;
a='10jan2012'd;
b='10:20:30't;
want=dhms(a,0,0,b);
format a date9. b time8. want datetime20.;

run;

View solution in original post

3 REPLIES 3
MSK4
Obsidian | Level 7
I have tried this but i donna whether it right or wrong.
please correct me .
data a;
a='10dec2019'd;
b='10:12:30't;
format a date9. b time8.;
run;
data ab;
set a;
c=put(a,date9.);
d=put(b,time8.);
g=input(catx(':',put(a,date9.),put(b,time8.)),datetime20.);
format g datetime20.;
run;
andreas_lds
Jade | Level 19

try

datetime = dhms(a, hour(b), minutes(b), seconds(b));
Ksharp
Super User
data have;
a='10jan2012'd;
b='10:20:30't;
want=dhms(a,0,0,b);
format a date9. b time8. want datetime20.;

run;

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1155 views
  • 5 likes
  • 3 in conversation