/* Sometimes it is necessary to reorganize data in periods instead of having the data */
/* in one row per time span. This example combines the INTNX and INTCK functions to do that */
length christmas_food1 christmas_food2 $ 22;
input christmas_food1 $ christmas_food2 $ start_date: date9. end_date :date9. quantum;
format start_date end_date ddmmyyp10.;
Trouth VanillaPudding 01dec2021 23dec2021 20
Ribs PepperCake 24dec2021 27dec2021 5
ChristmasPudding Beer 28dec2021 10jan2022 10
/* Use the INTNX function to make periods from date spans */
do i=0 to number_of_days;
format date ddmmyy10.;
/* Combine the INTCK and the INTNX functions to make periods other than days */
do i=0 to number_of_weeks;
format week yyweekv8.;
One of the advantages of this technique is that it is possible to distribute measures on time periods other than those on the basic data. A disadvantage could be that it generates a lot of rows in the result data set, but SAS is capable to handle that!
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.