Finally I developed the code for the my requests and it is working fine.
%let start=%eval(%sysfunc(today())-1);
Code for Request 1 :
data want; set have; retain flag_3 1 count 0 build_date &start. ; format build_date yymmdd10.; if count = 0 then do; do until (weekday(build_date) not in (1,7)); build_date + 1; end; count = 2 + (-flag_3); /* flag_3 = not flag_3;*/ end; else count + (-1); /*drop count flag_3;*/ run;
Code for Request 2 :
data want; set have; retain flag_3 1 count 0 build_date &start. ; format build_date yymmdd10.; if count = 0 then do; do until (weekday(build_date) not in (1,7)); build_date + 1; end; count = 3 + (-flag_3); /* flag_3 = not flag_3;*/ end; else count + (-1); /*drop count flag_3;*/ run;
Code for Request 3 :
data want; set have; retain flag_3 2 count 0 build_date &start. ; format build_date yymmdd10.; if count = 0 then do; do until (weekday(build_date) not in (1,7)); build_date + 1; end; count = 3 + (-flag_3); /* flag_3 = not flag_3;*/ end; else count + (-1); /*drop count flag_3;*/ run;
Code for Request 4 :
data want; set have; retain flag_3 1 count 0 build_date &start. ; format build_date yymmdd10.; if count = 0 then do; do until (weekday(build_date) not in (1,7)); build_date + 1; end; count = 1 + (-flag_3); /* flag_3 = not flag_3;*/ end; else count + (-1); /*drop count flag_3;*/ run;
... View more