Search code examples
sas

Calculate days between an interval with intck


I'm trying to calculate the days between two dates for example 01JAN2020-30NOV2021 but without success. I tried: days=intck("days", start, end+1) but it does not work. Dates are numeric after PROC CONTENTS. Is this the problem? As an example I showed one date but I have to calculate days for 3000 records.

Thank you in advance


Solution

  • There is no interval named DAYS. You could use the DAY interval.

    days=intck("day", start, end+1);
    

    But since DATE values are just number of days you can also just subtract.

    days=end - start + 1 ;