@ChrisHemedinger: It's definitely an inconsistency. Paragraph 2 of the page http://support.sas.com/documentation/cdl/en/etsug/63939/HTML/default/viewer.htm#etsug_intervals_sect...
states:
Create a data set that describes the custom interval. The data set must contain a BEGIN variable. It can also contain an END and a SEASON variable. It should contain a FORMAT statement for the BEGIN variable that specifies a SAS date, SAS datetime, or numeric format that matches the BEGIN variable data. If the END variable is present, it should also be included in the FORMAT statement. A numeric format that is not a SAS date or SAS datetime format indicates that the values are observation numbers. If the END variable is not present, then the implied value of END at each observation is one less than the value of BEGIN at the next observation.
However, I'll trade Naming rights for a free year's SAS license 🙂
Art, CEO, AnalystFinder.com
I don't think it's END specifically (though I would obviously defer to Chris and Rick and company since they've got the inside scoop).
What I think is happening is that with END specified the way Art did - there are days that are not in _any_ interval. While I would implement this differently (to tolerate that), obviously it wasn't.
Reeza's suggestion of dropping END must mean that SAS assumes the END is the _next_ begin; so that works. But you could also make this work directly. Here's the simpler (weekday only, ignoring holiday) version, though Art's could be nearly identically modified.
data work.an_interval;
format begin end date9.;
do begin = '01JAN2010'd to '01JAN2018'd;
end=begin;
do while (weekday(end) in (1,7));
end=end+1;
end;
output;
begin=end;
end;
run;
options intervalds=(testint=work.an_interval);
data test;
days=intck('testint','1jan2017'd,'31jan2017'd)+1;
run;
That works fine (while the BEGIN/END always equal solution doesn't, since 1/1/17 was a weekend).
Of course, I'm not sure what the value of END is then, since you need to have complete coverage; perhaps it lets you build intervals that intentionally exclude dates that shouldn't be considered valid inputs to the program?
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.