The data set orion.orders contains information about in-store, catalog, and Internet orders as well as delivery dates.
Partial orion.orders (490 Total Observations)
Order_ Order Delivery
Order_ID Type Employee_ID Customer_ID Date Date
1230058123 1 121039 63 11JAN2007 11JAN2007
1230080101 2 99999999 5 15JAN2007 19JAN2007
1230106883 2 99999999 45 20JAN2007 22JAN2007
1230147441 1 120174 41 28JAN2007 28JAN2007
1230315085 1 120134 183 27FEB2007 27FEB2007
a. Orion Star wants to study catalog and Internet orders that were delivered quickly, as well as those that went slowly.
- Create three data sets namedwork.fast,work.slow, andwork.veryslow.
- type WHERE statement to read only the observations withOrder_Typeequal to 2 (catalog) or 3 (Internet).
- Make a variable namedShipDaysthat is the number of days between when the order is placed and when the order is delivered.
- Handle the output as follows:
- Output to work.fast when the value of ShipDays is less than 3.
- Output to work.slow when the value of ShipDays is 5 to 7.
- Output to work.veryslow when the value of ShipDays is greater than 7.
- Do not output an observation when the value of ShipDays is 3 or 4.
- Drop the variableEmployee_ID.
- There should be 80 observations inwork.fast, 69 observations inwork.slow, and 5 observations inwork.veryslow.
Of the 490 observations in orion.orders, only 230 are read due to the WHERE statement.
b. Print your results from work.veryslow with an appropriate title.
work.veryslow
Orders taking more than 7 days to deliver
Order_ Order_ Delivery Ship
Obs Order_ID Type Customer_ID Date Date Days
1 1231305521 2 16 27AUG2007 04SEP2007 8
2 1236483576 2 70108 22JUL2009 02AUG2009 11
3 1236965430 3 70165 08SEP2009 18SEP2009 10
4 1237165927 3 79 27SEP2009 08OCT2009 11
5 1241298131 2 2806 29JAN2011 08FEB2011 10
C. Type solution to the previous exercise using SELECT logic instead of IF-THEN/ELSE logic. Refer to SAS documentation to explore the use of a compound expression in a SELECT statement. Print the data set work.veryslow.