The data set orion.orders contains information about in-store, catalog, and Internet orders as well as delivery dates.
Partial orion.orders (490 Total Observa
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
1230333319 2 99999999 79 02MAR2007 03MAR2007
a. Do two data sets, work.instore and work.delivery, to analyze in-store sales.
- Use a WHERE statement to read-only observations withOrder_Typeequal to 1.
- Make a variableShipDaysthat is the number of days between when the order was placed and when the order was delivered.
- Output towork.instorewhenShipDaysis equal to 0.
- Output towork.deliverywhenShipDaysis greater than 0.
- Thework.instoredata set should contain three variables (Order_ID,Customer_ID, andOrder_Date).
The work.delivery data set should contain four variables (Order_ID, Customer_ID, Order_Date, and ShipDays).
- Test this program by reading the first 30 observations that satisfy the WHERE statement. Check the SAS log to verify that no warnings or errors were reported.
b. Modify the program to read the full orion.orders data set. Of the 490 observations in orion.orders, only 260 are read due to the WHERE statement.
c. Print your results from work.delivery with an appropriate title.
Partial work.delivery (10 Total Observations) Deliveries from In-store Purchases
Order_ Ship
Obs Order_ID Customer_ID Date Days
1 1231468750 52 25SEP2007 5
2 1231657078 63 29OCT2007 4
3 1232648239 49 07APR2008 8
4 1241063739 89 03JAN2011 1
5 1241235281 171 23JAN2011 7
d. Use PROC FREQ to display the number of orders per year in work.instore. Add an appropriate title.
Hint: Format the variable Order_Date with a YEAR. format. Restrict the analysis to the variable Order_Date with a TABLES statement.