Larx
Larx

Reputation: 161

Convert text ddmmyyyy to SAS date with format Date9

I have a text column with data in the form of 'dd.mm.yyyy'. I need to convert it to SAS Date with format Date9.

mydate(text format)       newdate(Date format)
06.02.2019                06FEB2019
09.02.2019                09FEB2019

I did the following but it returns missing.

input(compress(t1.mydate, '.'), date7.)

then I format to Date9. but result is missing.

Can someone tell me what am I doing wrong?

Regards

Upvotes: 0

Views: 3992

Answers (1)

Larx
Larx

Reputation: 161

I found that it works if I put format ddmmyy8, instead of date7.

input(compress(t1.'Interaction Date'n, '.'), ddmmyy8.)

then format to Date9.

Upvotes: 1

Related Questions