This problem seems easier with the Week Function
This problem seems easier with the Week Function
"Not working" is awful vague.
Are there errors in the log?: Post the code and log in a code box opened with the {i} to maintain formatting of error messages.
No output? Post any log in a code box.
Unexpected output? Provide input data in the form of data step code pasted into a code box, the actual results and the expected results. Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.
Perhaps you can make up synthetic data to reproduce the problem, with a log you can publish.
@BETO wrote:
Now that i id week 1 of the month is there a way to get it to sure it by date range for example
Date sales
09/03/19 - 09/06/19. $0000.00
09/09/19 - 09/13/19. $0000.00
09/16/19 - 09/20/19 $00000.00
09/23/19 - 09/27/19. $00000.00
The data looks like this
Date. Sales
09/09/19. 0000
09/10/19. 0000
09/13/19. 0000
09/15/19. 0000
09/16/19: 0000
09/24/19. 0000
09/27/19. 0000
Where does this interval come from?
09/03/19 - 09/06/19?
I think you may be excluding holidays now but have not explicitly stated that anywhere.
So what "interval" would expect for values in the first week of July 2019 where July 4 is a holiday that appears on Thursday??, or Christmas, New Years as other holidays that change day of the week? or Thanksgiving that is always a Thursday.
I think your "interval" display needs some additional description, rules and example in an out data. The example "have" data is easy. Here is a calendar worth:
data have; do date= '01Jan2019'd to '31Dec2019'd; output; end; format date date9.; run;
Now provide examples of the interval value for each of those dates.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.