SAS Output Data between dates

  • INTCK() will find the number of months between two dates

  • INTNX() will increment dates by a specified amount, ie 1 month, 1 week

  • An explicit OUTPUT statement will write a new line for each month

     data have;
     informat name $8. date_start date_end mmddyy10.;
     format name $8. date_start date_end mmddyy10.;
     input Name date_start date_end;
     John 1/1/2020 3/31/2020
     Amy 3/1/2019 3/10/2019
     data want;
     set have;
     nMonths=intck('month', date_start, date_end, 'C');
     do i=0 to nMonths;
         Effective_YM=intnx('month', date_start, i, 's');
         format effective_YM yymmn6.;
     drop nMonths;

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top