• Home
  • Blog
  • SAS revisit the online sales data

SAS revisit the online sales data

0 comments

Let’s revisit the online sales data. Here is the code to load data and some additional variables we created. Use the following code to start your work.

Variable Information:

  • InvoiceNo: Invoice number. Nominal, a 6-digit integral number uniquely assigned to each transaction. If this code starts with letter ‘c’, it indicates a cancellation.
  • StockCode: Product (item) code. Nominal, a 5-digit integral number uniquely assigned to each distinct product.
  • Description: Product (item) name. Nominal.
  • Quantity: The quantities of each product (item) per transaction. Numeric.
  • InvoiceDate: Invice Date and time. Numeric, the day and time when each transaction was generated.
  • UnitPrice: Unit price. Numeric, Product price per unit in sterling.
  • CustomerID: Customer number. Nominal, a 5-digit integral number uniquely assigned to each customer.
  • Country: Country name. Nominal, the name of the country where each customer resides.

filename webdat url
"https://bigblue.depaul.edu/jlee141/econdata/eco520/online_retail.csv" ;

/* Import Helathcalim data*/
PROC IMPORT OUT= online_retail
DATAFILE= webdat
DBMS=CSV REPLACE;
RUN;
proc contents ; run ;


data sales1; set online_retail ;
date = datepart(Invoicedate) ;
yearmm = year(date)*100+month(date) ;
totalsale = UnitPrice*Quantity ;
logtotal = log(totalsale) ;
month = month(date) ;
quarter = qtr(date) ;
itemID = 1*substr(StockCode,1,4) ;
if itemID = . then delete ;
l_date = '31DEC2011'D ;
format date l_date mmddyy10.;
run ;
proc means ; run ;

proc freq data=sales1 order=freq ; tables itemID*month ; run ;
  • What are the sales patterns in terms of various perspectives such as products/items, regions and time (weekly, monthly, quarterly, yearly and seasonally), and so on?
  • Who are the most/least valuable customers to the business? What are the distinct characteristics of them?
  • Who are the most/least loyal customers, and how are they characterized?
  • Which types of customers are more likely to respond to a certain promotion mailing?
  • Using the univariate command in SAS, find the outliers of customers and item IDs.
  • All questions need to be type with appropriate graphs and tables from SAS in a PDF file.
  • Submit your SAS code as a separate txt file.

About the Author

Follow me


{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}