'Convert Timestamp to Numeric value in SAS

How to convert the default timestamp "0001-01-01-00.00.00.000000" in SAS, i have tried below code but it has returned null value. Can someone help on this please

data _NULL_;

x = "0001-01-01-00.00.00.000000";

rlstime = input(x,anydtdtm26.);

call symput('rlstime',rlstime);

run;

%put rlst: &rlstime;


Solution 1:[1]

As far as I remember, SAS cannot do that. Any date/timestamp before 1.1.1600 doesn't exist for SAS. Do you need it or can you just replace it with a null value? If you really need it you could transform it into another valid timestamp, split it into different columns (year, month, etc.) or just use it as a string. In your example you just write the timestamp into the log, meaning it's not necessary to transform it.

Solution 2:[2]

The earliest date that SAS will handle is 1st January, 1582. Additionally, a colon character should be used to delimit the time from the date, as well as the hours, minutes and seconds. Therefore, your code may be adjusted to the following:

data _NULL_;
  x = "1582-01-01:00:00:00.000000";
  rlstime = input(x,anydtdtm26.);
  call symput('rlstime',rlstime);
run;
%put rlst: &rlstime;

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Shalltear Bloodfallen
Solution 2 Dev.T