简体   繁体   English

从 SAS 中的日期检索月份和年份

[英]Retrieving Month and Year from a date in SAS

I am comparing dates from two tables.我正在比较两个表中的日期。 Values1 = 28/07/2020 Values2 = 26/06/2020 I tried using the intnx function. Values1 = 28/07/2020 Values2 = 26/06/2020 我尝试使用 intnx 函数。 it doesnt provide the right results.它没有提供正确的结果。 it should compare only the month and year and spit out the differences它应该只比较月份和年份并吐出差异

intnx is for advancing or retreating a date value to another date value. intnx用于将日期值提前或后退到另一个日期值。

The correct function for computing intervals is INTCK .计算区间的正确函数是INTCK

* variables contain SAS date values;

month_diff = intck ('month', values1, values2);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM