BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ambadi007
Quartz | Level 8

Hi Team,

 

I want to create an year value and it should be exact one year from today irrespective of leap year or what ever I have tried the below code

 

test=intnx('month',today(),-12,'B');

 

But it was not giving exact exact one year difference it was giving 01-May-2015 but i need 12-May-2015 ie if the job is running today it should calculate exact one year difference.

 

Thanks

 

Manesh

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

The last parameter for your intnx should be same. 

You also should use year and -1 interval. 

 

Intns('yeat', today(), -1, 's')

View solution in original post

3 REPLIES 3
Reeza
Super User

The last parameter for your intnx should be same. 

You also should use year and -1 interval. 

 

Intns('yeat', today(), -1, 's')

Astounding
PROC Star

Also, you may want to compare these two to see if they give you the same results for leap years:

 

intnx('year', today(), -1, 'S')

 

intnx('month', today(), -12, 'S')

 

it's possible they are equivalent, but check for a Feb 28, Feb29, and March 1 date to see what you get.

 

 

***

 

I found time to test them ... they generate the same result.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 895 views
  • 1 like
  • 4 in conversation