SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

SAS macro for 1 year from today

Accepted Solution Solved
Reply
Regular Contributor
Posts: 225
Accepted Solution

SAS macro for 1 year from today

Hi All,

 

   How I can use SAS macro for one year from today?

  I used the Macro below and got the wrong date as 01Jan2017, is there anything I did wrong? Thank you!

 

%let LYT=%sysfunc(intnx(year,%sysfunc(today()),-1),date9.);

%PUT &LYT;

 

Jade


Accepted Solutions
Solution
‎06-15-2018 02:05 PM
PROC Star
Posts: 626

Re: SAS macro for 1 year from today

[ Edited ]

%let LYT=%sysfunc(intnx(year,%sysfunc(today()),-1,s), date9. );

%PUT &LYT;

 

If you miss the aurguent "SAMEDAY" or "S" or "SAME" then by default it will give you 1st day of the year.

 

 

Thanks,
Suryakiran

View solution in original post


All Replies
Super User
Posts: 2,049

Re: SAS macro for 1 year from today

%let LYT=%sysfunc(intnx(year,%sysfunc(today()),-1,s), date9. );

%PUT &LYT;
Solution
‎06-15-2018 02:05 PM
PROC Star
Posts: 626

Re: SAS macro for 1 year from today

[ Edited ]

%let LYT=%sysfunc(intnx(year,%sysfunc(today()),-1,s), date9. );

%PUT &LYT;

 

If you miss the aurguent "SAMEDAY" or "S" or "SAME" then by default it will give you 1st day of the year.

 

 

Thanks,
Suryakiran
Regular Contributor
Posts: 225

Re: SAS macro for 1 year from today

Posted in reply to SuryaKiran

Thank you!

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 143 views
  • 0 likes
  • 3 in conversation