Hi Team,
I have mainframe dates as 2458058,2458150,2458239. Is there a way I can convert these mainframe dates to readable dates as date9.?
Thanks
Might not hurt to mention which mainframe ...
its in SAS mainframe
@kajal_30 wrote:
its in SAS mainframe
SAS is software and runs on many hardware platforms and operating systems. Mainframe refers to the hardware as various hardware systems will treat their native dates differently. Sometimes the hardware could even run different operating systems, some flavor of UNIX vs Z/OS for example.
If the value in a SAS data set were numeric 2458058 then that would correspond to a SAS date value of 09DEC8689. So I suspect that you have a need to read a value from the operating system and convert to an actual SAS date value.
So which hardware and which operating system and what dates would those values reflect?
And to which dates should these numbers (or strings) translate? Please give examples, or supply a formula.
there is no formula or final results I can see they are only being used in the filter condition.I want to know what dates these numbers represents
Where are you reading these dates from? There is no such thing as a "standard mainframe date format" so unless you tell us more about where you are reading dates and how they are stored then we can't help.
You have to find some reference points for these values. Dividing by 365.25 (my suspicion was that these are counts of days from 0001-01-01) or 86400 did not end with values that make sense as dates.
If someone used these values in the context of dates without documenting how they are calculated, said someone needs to be flogged publicly in front of the whole IT department, pour encourager les autres.
Unless the calculation method is commonly used in your company, and every mainframe programmer there knows it like we know that SAS dates start at 1960-01-01.
This could it be a "SQL Server corrected" Julian date.
data T;
  JULDATE = 2458239;
  SASDATE = JULDATE - 2361331 + '01jan1753'd ;
  putlog SASDATE= date9. ;
run;SASDATE=30APR2018 
See here and here. The start would be at noon on the 1st of January 4713 BC. Or something.
I'm off making up my own new date format...
@kajal_30 You'd be much better off having at least one value to validate the formula.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
