将时间戳转换为SAS中的数字值
如何将默认时间戳“ 0001-01-01-00.00.00.000000”转换为SAS,我尝试了以下代码,但已返回null值。有人可以帮忙吗
data _NULL_;
x = "0001-01-01-00.00.00.000000";
rlstime = input(x,anydtdtm26.);
call symput('rlstime',rlstime);
run;
%put rlst: &rlstime;
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;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
SAS处理的最早日期是1582年1月1日。此外,应使用结肠字符来界定日期以及小时,分钟和秒的时间。因此,您的代码可以调整为以下内容:
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:
据我记得,SAS无法做到这一点。 SAS不存在1.1.1600之前的任何日期/时间戳。您需要它还是可以用无效的值替换它?如果您真的需要它,则可以将其转换为另一个有效的时间戳,将其分为不同的列(年,月份等),或将其用作字符串。在您的示例中,您只需将时间戳写入日志中,这意味着不需要对其进行转换。
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.