T1.date is not a SAS date it seems? Why? You are making your life harder if you don't store a SAS date.
202210 this refers year and date
I only see year and month?
. That value needs to be changed on daily basis
Why change daily if you just filter on month?
I suppose you could use something like
where T1.Fiscalweek = year(today()) * 100 + week(today())
Check the week() function to see options about how the week is calculated
Try with a different date instead of today().
Try '14mar2022'd for example.
Did you read about the week () function to ensure you have to appropriate option in place?
@Pandu2 wrote:
I tried by providing different dates but I found something strange. Feb 28th started on Monday and the week ended on 6th March for this entire week it should give the FW as 09 but from 28th Feb to 05Th March it is giving as 09. For 06th March it is giving the FW as 10th even though 6th was part of old week.
Study the documentation (Maxim1) of the WEEK Function . It provides an additional parameter (called "descriptor" in the doc) which controls when the week begins, and how to treat incomplete weeks at the beginning of the year.
TRY IT. (Maxim 4)
Run this:
data check;
do date = '01jan2022' to today();
week = week(date);
output;
end;
format date yymmdd10.;
run;
and look at the dataset to see if it provides the week numbers you expect. If this is not the case, post examples and the numbers you expect instead.
Please do not delete the contents of your post. The purpose of the forum is to create a searchable history for others as well.
And when your questions are answered please select the appropriate response that answered your question and select that as the solution.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.