Quartz | Level 8

## Determine no orders

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

Id. Date s. m tue. wed thu fri sat
A1. 02/14/19. N. Y. N. Y. Y. N. N
B1. 02/14/19. N. Y. N. Y. N N. N

As you can see A1 02/14/19 is done correctly
And B1 was done on wrong sch date
I would need the ones done on wrong sch day to
Create a different dataset . Its should vary count from 3 to 300 .. thank you for the help
1 ACCEPTED SOLUTION

Accepted Solutions
Super User

## Re: Determine no orders

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 ;
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```
8 REPLIES 8
Opal | Level 21

## Re: Determine no orders

"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"

Quartz | Level 8

## Re: Determine no orders

Ok my table looks like this
Id. Date s. m tue. wed thu fri sat
A1. 02/14/19. N. Y. N. Y. Y. N. N
B1. 02/14/19. N. Y. N. Y. N N. N
The date is day of order sun-Sat is the schedule days order should be place. A1 is good since order was done on thur and sch indicates Y on Thur. Im interested only on the ones that had order place but weren't Scheduled like B1
SAS Super FREQ

## Re: Determine no orders

Hi:
I agree with @Patrick, your question is not clear. In addition, you seem to think that B1 is incorrect, but I don't see what is wrong with B1, if you say that A1 is correct.

Cynthia
Super User

## Re: Determine no orders

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 ;
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```
Quartz | Level 8

## Re: Determine no orders

Thank you Tom will give it a try
Quartz | Level 8

## Re: Determine no orders

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
Super User

## Re: Determine no orders

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

Quartz | Level 8

## Re: Determine no orders

Thanks Tom
Discussion stats
• 8 replies
• 1089 views
• 2 likes
• 5 in conversation