Search the site...

SASCRUNCH TRAINING
  • Home
  • Member's Area
  • How to Start
  • SAS Interface
  • Creating a Data Set
  • Practical SAS Training Course
  • SAS Certified Specialist Training Program
  • Proc SQL Course
  • Introduction to Time Series Analysis
  • SAS Project Training Course
  • Full Training / Membership
  • Sign up
  • About us
  • Contact us
  • Home
  • Member's Area
  • How to Start
  • SAS Interface
  • Creating a Data Set
  • Practical SAS Training Course
  • SAS Certified Specialist Training Program
  • Proc SQL Course
  • Introduction to Time Series Analysis
  • SAS Project Training Course
  • Full Training / Membership
  • Sign up
  • About us
  • Contact us
Sentry Page Protection
Please Wait...
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:
  • 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:
Picture

Option 1: Walmart only

The total cost when buying from Walmart only is $1.69 + $1.29 + $5 (shipping) = $7.98.
Picture

Option 2: Amazon only

The total cost when buying from Amazon only is $5.04 + $0.65 + $5 (shipping) = $10.69
Picture

Option 3: Both

The total cost when buying from both Walmart and Amazon is $1.69 + $0.65 + $10 (shipping) = $12.34.
Picture

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:
Picture

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:
Picture

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:
Picture
Next
Already a member? Go to member's area.