Based on your code it appears you don't fully grasp yet how to work with SAS Date values and all the advantages this brings.
Week numbers are unfortunately one of the trickier things to work with because there are different ways for deriving these - like does a week start on Sunday or Monday, what defines when the first week of a year starts, does the count start with 0 or with 1?
For your real data: What date range do you actually try to select? Would there be another variable in your data that we could use to define a range like:
From a given date select all rows with a date one week back and 5 weeks into the future.
Please describe in words what you have and how you want to select the data. Ideally also provide sample data representative for your real data.
If there is not other date (string) we can use than yyyyww then please explain in detail how the week number gets determined (...and there can be 53 weeks in a year).
... View more