Datetime SAS信息日期时间毫秒

Datetime SAS信息日期时间毫秒,datetime,sas,informat,Datetime,Sas,Informat,SAS能否存储和使用包含小于十分之一秒分数的日期时间 例如: 您的示例代码在打印输出上舍入。添加一个格式,例如best32。在看跌期权声明中显示持有的精度更高 data _null_; input @1 from_dt:datetime22.; put from_dt= best32.; cards; 24Sep2009:11:21:19.856 ; run; from_dt=1569410479.856 您的示例代码在打印输出上舍入。添加一个格式,例如best32。在看跌期权声

SAS能否存储和使用包含小于十分之一秒分数的日期时间

例如:


您的示例代码在打印输出上舍入。添加一个格式,例如best32。在看跌期权声明中显示持有的精度更高

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

from_dt=1569410479.856

您的示例代码在打印输出上舍入。添加一个格式,例如best32。在看跌期权声明中显示持有的精度更高

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

from_dt=1569410479.856

正如罗格所指出的,您可以以超过0.1秒的精度读入和存储日期时间


只需使用datetime22.3或类似的格式和信息,而不是datetime22。

正如罗格所指出的,您可以以超过0.1秒的精度读取和存储日期时间


只需使用datetime22.3或类似的格式和信息,而不是datetime22。

datetime变量是一个数字变量,与任何其他数字变量一样。我们只是将其值理解为自1960T000:00:00起的秒数。希望这有帮助

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.
*/

datetime变量是一个数值变量,与任何其他数值变量一样。我们只是将其值理解为自1960T000:00:00起的秒数。希望这有帮助

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.
*/