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...
Geo-targeting Project [16-25]


We can now calculate the distance between the two coordinates by using a simple formula:
Picture
data sales_q1_loc_pos4;
set sales_q1_loc_pos3;

distance = round(((store_x-cust_x)**2 + (store_y-cust_y)**2) **0.5, 1);

run;
Did the code fail?

Copy and run the code below to create the input data sets.

Let's examine how far customers traveled to buy computers.

In the first transaction, the distance calculated is 4691.
Picture

This means the distance between the customer's address and the store location is 4691 meters or (4.7 km).

This customer traveled 4.7 km to make this particular transaction.
Next
Already a member? Go to member's area.