Sentry Page Protection
Exercise (9-10)
You are developing an app that allows you to compare the total grocery cost between Walmart, Amazon or both.
When purchasing the groceries online, you have three options:
For example, if the customer has decided to buy apple juice and apple sauce online.
Prices for the two items are shown below:
You are developing an app that allows you to compare the total grocery cost between Walmart, Amazon or both.
When purchasing the groceries online, you have three options:
- Buy only from Walmart
- Buy only from Amazon
- Buy from both Walmart and Amazon by selecting the lower price between the two stores.
For example, if the customer has decided to buy apple juice and apple sauce online.
Prices for the two items are shown below:
Option 1: Walmart only
The total cost when buying from Walmart only is $1.69 + $1.29 + $5 (shipping) = $7.98.
Option 2: Amazon only
The total cost when buying from Amazon only is $5.04 + $0.65 + $5 (shipping) = $10.69
Option 3: Both
The total cost when buying from both Walmart and Amazon is $1.69 + $0.65 + $10 (shipping) = $12.34.
For these two items, it is cheaper to just buy everything from Walmart.
You now have to create a program that automatically compares the three prices, and then displays the best option for the customer.
Task 1
Write a Proc SQL step to inner join the WALMART and AMAZON tables.
The output should look like this:
Task 2
Compute the sub-total for each item in the shopping cart based on the lower price between the two stores.
The output table should look like this:
Task 3
Write a Proc SQL step to create a SAS table that contains the subtotal for the order (before shipping), $10 shipping charges and the total cost including shipping.
Name the table as COMBINEDPRICE.
The output table should look like this: