11-04-2016 10:35 AM
I have a list variable that is a list of dates ranging from 2008-2016. I'd like to recode those dates into biweekly periods. So essentally a variable with 26 categories and if the date falls within that period, it would be recoded as such.
The result would look like this:
Any help would be greatly appreciated!
11-04-2016 10:44 AM
The function WEEK will return a week number of a year from a SAS date value.So you could use the Week function and divide by 2 and round to get a biweek value. One thing to consider is when your week count starts. The function has option U, V and W which determine some rules for which "week" a date may be based on how the calendar year starts and whether Sunday or Monday is the first day of the week.
Note that since there are 52.14 weeks in a year (and a bit more in leap years) you can have the last couple days of December actually in week 53.