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
Task [4-4]

The data set ONLINE_RETAIL contains all online sales data for all countries, up to and including September 2011. 

​Now that you know each country could submit their data to you differently, you would like to create a macro to reduce the amount of code required each time you add data to the ONLINE_RETAIL data set.​
france_sales_201111.sas7bdat
File Size: 327 kb
File Type: sas7bdat
Download File

france_sales_201112.sas7bdat
File Size: 131 kb
File Type: sas7bdat
Download File

germany_sales_201111.sas7bdat
File Size: 196 kb
File Type: sas7bdat
Download File

germany_sales_201112.sas7bdat
File Size: 131 kb
File Type: sas7bdat
Download File


First, create a new dataset ONLINE_RETAIL_MASTER which is a copy of ONLINE_RETAIL.
 
Next, using the code for Task 2 and Task 3, create a macro which will append the monthly sales data from different countries to ONLINE_RETAIL_MASTER. 

​The macro should have the following features:
  1. Two parameters:
    (a) Data: to specify the dataset name to be added to ONLINE_RETAIL
    (b) Country: to specify the country where the dataset originated from.

  2. Depending on the country specified, the macro should conditionally execute either the code from Task 2 (if France was specified for country) or the code from Task 3 (if Germany was specified for the country).

  3. After each run, use a %put statement to output the number of records to the log found in ONLINE_RETAIL_MASTER, both before running the load macro and after running the load macro.
    ​
  4. Use your macro to load the French and German sales data for October, November and December 2011, like this:  
 
%load(data=a.france_sales_201110,country=France);
%load(data=a.france_sales_201111,country=France); 
%load(data=a.france_sales_201112,country=France); 
 
%load(data=a.germany_sales_201110,country=Germany); 
%load(data=a.germany_sales_201111,country=Germany);
%load(data=a.germany_sales_201112,country=Germany);
 
Tip: PROC APPEND can be used within the macro to ensure that the data sets are being added to ONLINE_RETAIL with each run of the macro.

End of Project
Do you need help?
Already a member? Go to member's area.