Reputation: 231
I have a bizarre situation where I have dates as characters, such as 06/May/2014. I'm converting them to SAS dates as follows:
data ae;
set ae;
format aestdt date10.;
aestdt=input(aestdat,date9.);
put aestdt=YYMMDD10.;
run;
What I get for the output variable is changing the year of the date from 2014 to 2020. So in the example above, I get 06MAY2020. All of the months and days look correct, so I can't figure out why the years are changing on me. Any ideas?
Upvotes: 1
Views: 195
Reputation: 63424
This is because you brought it in as date9.
. The 9
in an informat means how many characters do we look at to create this number?
. 06/MAY/2014
has not 9 but 11 characters.
data ae;
aestdat='06/MAY/2014';
format aestdt date10.;
aestdt=input(aestdat,date11.);
put aestdt=YYMMDD10.;
run;
This gives the expected result.
Upvotes: 4