I have a mainframe date as 1200617 and I want to use the same date in my base sas to do a data filtration.
Can anyone please help how can I convert this date to use in a base sas?
Why are you asking again? The answer was given (please choose an answer in the other thread) :
data HAVE;
*Format cYYMMDD - c= century number: 0 for 1800, 1 for 1900, 2 for 2000 ;
DATE = 1990401 ;
DATEZ = input(put(18000000+DATE,z8.),yymmdd8.);
format DATEZ date9.;
run;
It looks like for you, if C = 0 then it's 1900 and if C = 1 it's 2000, like here.
So you need to add 19000000.
Is this what you mean?
Why are you asking again? The answer was given (please choose an answer in the other thread) :
data HAVE;
*Format cYYMMDD - c= century number: 0 for 1800, 1 for 1900, 2 for 2000 ;
DATE = 1990401 ;
DATEZ = input(put(18000000+DATE,z8.),yymmdd8.);
format DATEZ date9.;
run;
It looks like for you, if C = 0 then it's 1900 and if C = 1 it's 2000, like here.
So you need to add 19000000.
Is this what you mean?
May I know the criteria for adding 18000000 or 19000000 ?
> May I know the criteria for adding 18000000 or 19000000 ?
Do you want a date starting with 120 to be 1920 or 2020?
I want it to be 2020
In case mainframe data has both old and new records and we have no idea if they are from year 2020 or 1900 is there a generic way to convert them into SAS dates?
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.