Date Week Selector Task
The date quarter selector task displays an Options tab containing a combo box. The choices in the combobox are:
- Select a week - week and year input fields prompt for values
- Current week
- Previous week
- Next week
- Current week of previous year
- Current week of next year
- N weeks ago - an input field prompts for an integer
- N weeks from now - an input field prompts for an integer
When a selection made and values are specified in any dependent controls the following macro variables are created and set as follows:
- week - the first day of the week selected or a function that calculates the first day of the week of the selection, formatted as DDMMMYYYY
- week_end - the last day of the week selected or a function that calculates the last day of the week of the selection, formatted as DDMMMYYYY
- week_rel - a code that represents the selection made
- week_label - the common name of the selection
An example of the code generated by this task when "Current week of previous year" is selected:
%global week;
%global week_end;
%global week_rel;
%global week_label;
%let week = %sysfunc(intnx(Week.2, %sysfunc(intnx(Year, %sysfunc(date()), -1,
s)), 0, b), DATE9.);
%let week_end = %sysfunc(intnx(Week.2, %sysfunc(intnx(Year, %sysfunc(date()),
-1, s)), 0, e), DATE9.);
%let week_label = Current week of last year;
%let week_rel = W0W-1Y;
%put _GLOBAL_;
If today is March 22, 2017 the macro variable values set by this example code are:
GLOBAL WEEK 21MAR2016
GLOBAL WEEK_END 27MAR2016
GLOBAL WEEK_LABEL Current week of last year
GLOBAL WEEK_REL W0W-1Y