DATA Step, Macro, Functions and more

intnx

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 12
Accepted Solution

intnx

The question is from the Prep Guide.

 

targetyear=intnx('Year','05feb94'd,3)

 

I was anticipating the answer 05feb97.However, the value is 13515 i.e., January1,1997. Why is that so?

However, the same functin used on semiyear yield the value as expected.

Eg.

targetMonth=intnx('semiyear','01jan2001'd,1) and the answer is 01July2001.


Accepted Solutions
Solution
‎05-02-2017 11:56 AM
PROC Star
Posts: 7,467

Re: intnx

Posted in reply to Sathiskumar_D

If you don't include the allignment option, beginning is the default. That is what you got for year (jan 1) and semi-year (july 1)

 

Art, CEO, AnalystFinder.com

 

View solution in original post


All Replies
Solution
‎05-02-2017 11:56 AM
PROC Star
Posts: 7,467

Re: intnx

Posted in reply to Sathiskumar_D

If you don't include the allignment option, beginning is the default. That is what you got for year (jan 1) and semi-year (july 1)

 

Art, CEO, AnalystFinder.com

 

Super User
Super User
Posts: 7,039

Re: intnx

Posted in reply to Sathiskumar_D

It just did what you asked it to do. If you want it to find the same point in the interval you need to tell it that.

targetyear=intnx('Year','05feb94'd,3,'same')
Super User
Posts: 19,770

Re: intnx

Posted in reply to Sathiskumar_D

INTNX() has 4 parameters, you've specified 3. 

The fourth parameter tells it how to align the dates: beginning, same, end, middle. 

The default is the beginning, which is being used. 

 

Occasional Contributor
Posts: 12

Re: intnx

thanks.

☑ This topic is solved.

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

Discussion stats
  • 4 replies
  • 157 views
  • 5 likes
  • 4 in conversation