Here's a variation on @novinosrin solution.
Most important changes - no loop initialization as that seems to imply RETAIN. This assumes you're working with SAS dates, not character variables.
*create sample data;
data have;
do period='04Jun2017'd to '15Jul2017'd;
output;
end;
format period weekdate21.;
run;
*create array/dummy vars - note this is overparameterized;
data want;
set have;
array wkday(*) Days1-Days7;
*initialize to 0, if initialized, implicit retain messes up data;
do i=1 to 7;
wkday(i)=0;
end;
*find day of week for period;
day_of_week = weekday(period);
*assign to value of 1;
wkday(day_of_week)=1;
run;
... View more