SAS信息datetime毫秒 [英] SAS informat datetime milliseconds

查看:299
本文介绍了SAS信息datetime毫秒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SAS可以存储和使用包含小于1/10秒的数据时间吗?



例如:

  data _null_; 
input @ 1 from_dt:datetime22;
put from_dt =;
卡;
24Sep2009:11:21:19.856
;
运行;


解决方案

datetime变量是一个数字变量,就像其他任何一个数字变量。我们只是从01jan1960T00:00:00了解其值。希望这有帮助。

  data _null_; 

/ *日期时间,1表示自午夜以来的1秒jan 1960年* /
dt = 1;
put dt:datetime;

/ *您可以使用datetime格式显示百分之一秒* /
dt = 0.01;
put dt:datetime19.2;

/ *但它只是一个双重类型的数字。你可以用任何其他数字
变量* /
dt = 0.01来做
你想要的变量。
putIt isdt:wordf15。 午后二点。
运行;
/ * on log
01JAN60:00:00:01
01JAN60:00:00:00.01
午夜后为零和01/100秒。
* /


Can SAS store and use datetimes that contain fractions of less than 1/10th of a second?

eg:

data _null_;
input @1 from_dt:datetime22.;
put from_dt= ;
cards;      
24Sep2009:11:21:19.856
;
run;

解决方案

A datetime variable is a numeric variable just like any other numeric variables. We just understand its value as the seconds since 01jan1960T00:00:00. Hope this helps.

data _null_;

  /* for date time, 1 means 1 sec since midnight jan 1st 1960 */
  dt = 1;
  put dt :datetime.;

  /* you can show the hundredth of second using datetime format */
  dt = 0.01;
  put dt :datetime19.2;

  /* but it is just a double type number. you can do
     what you want with the variable as with any other numeric
     variables */
  dt = 0.01;
  put "It was " dt :wordf15. "second after midnight.";
run;
/* on log
01JAN60:00:00:01
01JAN60:00:00:00.01
it was zero and 01/100 second after midnight.
*/

这篇关于SAS信息datetime毫秒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆