Я ничего не знаю о юлианском формате даты Oracle, но кажется, что это просто количество дней от некоторого "дня 0", как в SAS. День 0 в SAS - 01JAN1960, поэтому нам просто нужно вычислить смещение между системой Oracle, где 31DEC2013 - это номер дня 2456658, и системой SAS, где 31DEC2013 - 22280:
data dates;
time_key = 24566658; output;
time_key = 24566689; output;
run;
* Calculate the offset, given 24566658 is 31-Dec-2013;
data _null_;
call symput("offset", 24566658 - "31DEC2013"d);
run;
%put Offset from SAS dates to Oracle dates is &offset days;
data converted;
set dates;
* Adjust the Oracle date values by subtracting the calculated offset;
sas_time_key_numeric = time_key - &offset;
sas_time_key = put(time_key - &offset, date9.);
put time_key= sas_time_key_numeric= sas_time_key=;
run;
. вывод:
10 %put Offset from SAS dates to Oracle dates is &offset days;
Offset from SAS dates to Oracle dates is 24546935 days
11
12 data converted;
13 set dates;
14 sas_time_key_numeric = time_key - &offset;
15 sas_time_key = put(time_key - &offset, date9.);
16 put time_key= sas_time_key_numeric= sas_time_key=;
17 run;
time_key=24566658 sas_time_key_numeric=19723 sas_time_key=31DEC2013
time_key=24566689 sas_time_key_numeric=19754 sas_time_key=31JAN2014
Что дает правильное преобразование.
Итак, число волхвов c равно 24546935; вычтите это из ваших Oracle дат, чтобы получить соответствующее значение даты SAS, затем примените желаемый формат даты.