【问题标题】:SAS Aggregate to show results for the current year onlySAS 聚合仅显示当年的结果
【发布时间】:2022-01-22 18:06:29
【问题描述】:

我有一个表格,可以每周比较结果。

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

%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;

【问题讨论】:

  • 您的policy_vintage 列是数字吗?
  • 是的,它的数字

标签: sas


【解决方案1】:
%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.]
;

运行;

【讨论】:

    猜你喜欢
    • 2021-02-20
    • 2015-04-21
    • 1970-01-01
    • 2014-05-20
    • 2015-02-28
    • 1970-01-01
    • 1970-01-01
    • 2012-07-11
    • 1970-01-01
    相关资源
    最近更新 更多