SAS 聚合仅显示当年的结果

SAS Aggregate to show results for the current year only

我有一个 table,我每周比较结果。

我使用这些函数汇总了旧日期。

%let date_old=%sysfunc(intnx(year,%sysfunc(Today()),-1,s));
%put &=date_old;
proc format;
   value vintf low-&date_old = 'OLD' other=[yymmd7.];
run;
/*agregujemy wyniki do daty vintf jako old*/
proc summary data=tablea_new nway;
   class policy_vintage;
   format policy_vintage vintf.;
   var AKTYWNE WYGASLE;
   output out=newtabe sum=;

我也想做同样的事情,只是聚合日期以显示年度范围,即 2021-01-2022-01。或当前年份 2021-01-2021-12。下面的例子可以吗?执行此操作的最佳方法是什么?

%let date_future=%sysfunc(intnx(year,%sysfunc(Today()),+12,s));
%put &=date_future;
proc format;
   value vintfutr +&date_future= 'FUTURE' other=[yymmd7.];
run;
%let date_old=%sysfunc(intnx(year,%sysfunc(Today()),-1,s));
%let date_future=%sysfunc(intnx(year,%sysfunc(Today()),+1,s));
proc format;
value vintf
  low-&date_old = 'OLD'
  &date_future-high = 'FUTURE'
  other=[yymmd7.]
;

运行;