BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Gieorgie
Quartz | Level 8

I have a table where I compare the results week to week.

 

Gieorgie_0-1640075482958.png

 

I have aggregations of old dates using these functions.

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

And I would like to do exactly the same, only to aggregate the dates to show the yearly range, i.e. 2021-01-2022-01. Or the current year 2021-01-2021-12. Is the following sample okay? What's the best way to do this?

%let date_future=%sysfunc(intnx(year,%sysfunc(Today()),+12,s));
%put &=date_future;
proc format;
    value vintfutr +&date_future= 'FUTURE' other=[yymmd7.];
run;
1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

Try this:

%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.]
;
run;

View solution in original post

4 REPLIES 4
Gieorgie
Quartz | Level 8
I don't know if I understood you correctly. I would like aggregated OLD, i.e. all until the date of the current year as it is then each month in the current year, and then aggregation of FUTURE from the end of the year to the last date
Kurt_Bremser
Super User

Try this:

%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.]
;
run;
Gieorgie
Quartz | Level 8
Thanks Kurt very much ! Happy xmass 🙂

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1068 views
  • 1 like
  • 2 in conversation