0
votes

I am trying to convert a character to a date in sas and its driving me nuts that it is not working. The date is currently in character format as below

200609

I want to convert it to a similar date structure in proc sql but just cant get it to work. I am using the following code:

input(date,anydtdtm.) as Perf_Date format = date9.,

Can anyone suggest where I am going wrong?

1

1 Answers

0
votes

Use the actual informat. You're using anydtDTM - DTM means date time. You could also try ANYDTDTE which is looking for a date.

YYMMN6. works though and you can be sure it's correct.

data want;
x='200609';
y=input(catt(x, '01'), yymmn6.);
format y date9.;
run;

proc print;run;

01SEP2006