- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Data want;
Set have;
Retain weekno 0;
Length weektext $30;
If weekday (date)=1 then weekno+1;
If weekno>0 then weektext="week" !! Strip(put(weekno,2.))!! " " !! Strip(put(date,monname.));
My date is formatted yymmddd10.
When i run code the output is 0 for all entries im pulling month worth of data ...thanks for assistance
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
This problem seems easier with the Week Function
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
This problem seems easier with the Week Function
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
"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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Data table;
Set table:
Week=intck('week',intnx('month',day,0) ,day) +1;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Perhaps you can make up synthetic data to reproduce the problem, with a log you can publish.
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set
Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets
--------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content