Contributor
Posts: 26

# INTNX function - strange behaviuor

Hi,
Does anyone can explain what is the bahaviour of INTNX function when 'interval' argument is an integer number?

data test1;
format date1-date6 date.;
date1=intnx("1",today(),0,"b");
date2=intnx("2",today(),0,"b");
date3=intnx("3",today(),0,"b");
date4=intnx("4",today(),0,"b");
date5=intnx("5",today(),0,"b");
date6=intnx("6",today(),0,"b");
run;

The results are unexpected for me :/
Valued Guide
Posts: 2,191

## Re: INTNX function - strange behaviuor

Lucas

You are missing something.
Have you looked at the examples in the on line doc?
Contributor
Posts: 26

## Re: INTNX function - strange behaviuor

Peter.C

Of course I have looked. It is always first thing I try to do
Unfortunately there is nothing about situation I have mentioned.
There is only description of intervals like 'Year', 'Month', 'Week'...
Super Contributor
Posts: 3,176

## Re: INTNX function - strange behaviuor

Okay - please explain what you are attempting to accomplish with INTNX and what result would you like to see - show data values, please.

Scott Barry
SBBWorks, Inc.

Suggested Google advanced search argument, this topic / post:

using dates intnx site:sas.com
Valued Guide
Posts: 2,191

## Re: INTNX function - strange behaviuor

Lucas
pardon me for the inappropriateness of my response
I misjudged the objective of your posting
Your posting has served to inform us
as demonstrated by ArtC
That you can shift a default interval
interesting
peterC
PROC Star
Posts: 8,164

## Re: INTNX function - strange behaviuor

Peter,

Santa Clause was concerned there for a moment.

Art
Valued Guide
Posts: 2,191

## Re: INTNX function - strange behaviuor

;-)
Frequent Contributor
Posts: 79

## Re: INTNX function - strange behaviuor

I think you are misinterpreting what you can use as an interval. In the explantion of the intnx function there is a link that explains valid values.

The syntax explanation clearly states

interval
specifies the NAME of the basic interval type. For example, YEAR specifies yearly intervals.

For a complete list of the valid values for interval, see the Intervals Used with Date and Time Functions table in SAS Language Reference: Concepts.

I don't see '1','2' etc. listed in this table. Message was edited by: LAP
Valued Guide
Posts: 653

## Re: INTNX function - strange behaviuor

Lucas,
Are you pointing out an oddity? Like: "why didn't I get an error for using an unspecified interval?".

I believe the default interval is DAY and that the numbers are being picked up as interval multipliers. Which shows us a bit about how the interval is parsed when multipliers and shift operators are included. Consider this variation of your code:
[pre]data test1;
format date1-date6 date.;
date1=intnx("1",today(),0,"b");
date2=intnx("2",today(),0,"b");
date3=intnx("3",today(),0,"b");
date4=intnx("4",today(),0,"b");
date5=intnx("5",today(),0,"b");
date6=intnx("6",today(),0,"b");
output;
date1=intnx("day1",today(),0,"b");
date2=intnx("day2",today(),0,"b");
date3=intnx("day3",today(),0,"b");
date4=intnx("day4",today(),0,"b");
date5=intnx("day5",today(),0,"b");
date6=intnx("day6",today(),0,"b");
output;
run;
proc print data=test1;
run;[/pre]
Discussion stats
• 8 replies
• 244 views
• 0 likes
• 6 in conversation