Use the WEEKDAY() function.
data have;
input id $ date (d1-d7) (:$1.);
informat date mmddyy.;
format date yymmdd10. ;
cards;
A1 02/14/19 N Y N Y Y N N
B1 02/14/19 N Y N Y N N N
;
data check;
set have ;
array sched d1-d7 ;
bad = 'Y' ne sched(weekday(date));
run;
Obs id date d1 d2 d3 d4 d5 d6 d7 bad 1 A1 2019-02-14 N Y N Y Y N N 0 2 B1 2019-02-14 N Y N Y N N N 1
"I have a table that derermines orders on off days it looks like this SUN THRU SAT is weekly sch N no orders Y yes order"
I can't make sense of your description. Can you please elaborate/re-formulate.
Use the WEEKDAY() function.
data have;
input id $ date (d1-d7) (:$1.);
informat date mmddyy.;
format date yymmdd10. ;
cards;
A1 02/14/19 N Y N Y Y N N
B1 02/14/19 N Y N Y N N N
;
data check;
set have ;
array sched d1-d7 ;
bad = 'Y' ne sched(weekday(date));
run;
Obs id date d1 d2 d3 d4 d5 d6 d7 bad 1 A1 2019-02-14 N Y N Y Y N N 0 2 B1 2019-02-14 N Y N Y N N N 1
So for the order date, you need to find that day of the week, ie February 14, 2019 is a Thursday, so Thursday should have a Y. Since it doesn't you flag that record?
@Gil_ wrote:
Cynthia
The reason B1 is incorrect is the order was placed on 02/14/19. And per the schedule thur has a N. Which means the order was place on off day
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.