Date calculations in SAS

前端 未结 3 1329
轮回少年
轮回少年 2020-12-06 09:16

I want to add 1 day to an arbitrary SAS date. I have the following code that works but I wonder wether there is built-in support for date calculations like this:

<         


        
3条回答
  •  鱼传尺愫
    2020-12-06 09:40

    Itzy is right... just add 1. If you want to do more advanced date calculations you can use the intnx() and intck() functions.

    e.g.

    data _null_;
      tomorrow            = date() + 1;
      same_day_next_month = intnx('month',date(),1,'same');
      first_day_next_week = intnx('week' ,date(),1,'beginning');
      last_day_of_year    = intnx('year' ,date(),0,'end');
    
      put _all_; 
    run;
    

提交回复
热议问题