- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I'm totally confused!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
It does not:
1 data _null_;
2 do date = '1jan2024'd to '7jan2024'd;
3 week_u=week(date, 'u');
4 week_v=week(date, 'v');
5 week_w=week(date, 'w');
6 format date yymmdd10.;
7 put (_ALL_) (=);
8 end;
9 run;
date=2024-01-01 week_u=0 week_v=1 week_w=1
date=2024-01-02 week_u=0 week_v=1 week_w=1
date=2024-01-03 week_u=0 week_v=1 week_w=1
date=2024-01-04 week_u=0 week_v=1 week_w=1
date=2024-01-05 week_u=0 week_v=1 week_w=1
date=2024-01-06 week_u=0 week_v=1 week_w=1
date=2024-01-07 week_u=1 week_v=1 week_w=1
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
Did you read documentation for week()?
Bart
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug
"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings
SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The documentation explains it clearly
The WEEK function with the U descriptor reads a SAS date value and returns the number of the week within the year. The number-of-the-week value is represented as a decimal number in the range 0–53, with a leading zero and maximum value of 53. Week 0 means that the first day of the week occurs in the preceding year. The fifth week of the year is represented as 05.
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Google searches haven't included those descriptors and I have missed them.
Thanks for pointing out the correct solutions!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Start here : https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.4&docsetId=pgmsashome&docsetTarget=h...
And search within the SAS documentation.
Depending on your install the online help could be quite extensive and no reason to "google".