Crubal Chenxi Li
Crubal Chenxi Li

Reputation: 313

SAS DATE and TIME Conversion

I have a question in merging two tables by the date/time.

In table A, the format of variable 'dt1' is '20140127', where the type is numeric; In table B, the format of variable 'dt2' is '27JAN2014', where the type is date.

What function can I use so they can be corresponding to each other?

Thanks!

Upvotes: 0

Views: 41

Answers (1)

user667489
user667489

Reputation: 9569

I would recommend getting all your date variables stored as SAS dates so you can use the standard date functions with them. E.g.

data _null_;
 a1 = 20140127;
 a2 = '27jan2014'd
 b = input(a1,yymmdd8.);
 format a: b yymmdd10.;
 put _all_;
run;

Upvotes: 1

Related Questions