*Total 90 pts for this assignment;
*********************************************************************************;
*Q1: Examine the data set below and use it for the following questions. ;
data PrdSale;
input Country $ 1-8 ProdType $ 9-18 Product $ 19-24 Sales 25-30;
datalines;
CANADA FURNITURE BED 220
CANADA OFFICE CHAIR 35
CANADA FURNITURE SOFA 925
CANADA OFFICE CHAIR 35
CANADA FURNITURE BED 220
CANADA OFFICE TABLE 688
CANADA OFFICE CHAIR 35
GERMANY FURNITURE BED 641
GERMANY OFFICE CHAIR 468
GERMANY FURNITURE CHAIR 269
GERMANY FURNITURE SOFA 996
GERMANY OFFICE CHAIR 468
GERMANY OFFICE TABLE 597
U.S.A. FURNITURE BED 129
U.S.A. OFFICE CHAIR 229
U.S.A. OFFICE DESK 794
U.S.A OFFICE TABLE 956
U.S.A. FURNITURE SOFA 459
U.S.A OFFICE TABLE 956
U.S.A. OFFICE CHAIR 156
;
run;
**Q1.1 (10pts each method) Create a data set (name it EX1) ordered by Product and
keep only one observation for each Product. Use two different methods to do
this. ;
**Q1.2 (10pts each method) Create a data set (name it EX2) and eliminate any
observations that have the exactly same information for all variables.
Sort your data properly for better visualization. Use two different
methods to do this. ;
*********************************************************************************;
*Q2: Upload the data file Credit_Card_Transactions.csv and use it for this question;
**Q2.1 (5pts)Update your file path in the PROC IMPORT below and run the code. Use
the created SAS data set CARD for the rest of the questions;
proc import datafile=”/home/u63760632/STAT674/Examples/M1_Card/Credit_Card_Transactions.csv”
out=Card(rename= (“Customer ID”n = CustID
“Transaction ID”n = TransID
“Transaction Amount”n = Amount
“Merchant Name”n = Merchant))
dbms=csv replace;
run;
**Q2.2 (15pts)Use ONE proc means to do all of the following with the CARD dataset:
a. calculate the total transaction Amount for each Category each Date.
b. Save your result in a separate dataset and name the data Summary. Use the
original variable names as the output.
c. use TYPES statement to keep only the cross-tabulation between Category and
Date. In other words do not keep the overall amount, total by category or
total by date.
d. add a FORMAT statement in your proc means to make the variable Date look like
Jan23 (only month and year). Also format your variable Amount to display with
the dollar sign and comma separators.;
**Q2.3 (5pts)Answer the following questions based on your PROC MEANS above :
a. In your input data Card, is the Date varaible changing by day or by month?
b. In your result, is the total amount grouped by day or by month?
**Q2.4 (15pts)The PROC SGPLOT below is provided to create a series of graphs using
the data created in Q2.2.
Use ODS to save the result of PROC SGPLOT into a PDF file. Add a TITLE statement
in your PDF file to display “Transaction Trend by Spending Category”;
proc sgplot data=summary;
by category;
series x=date y=amount;
run;
**Q2.5 (10pts)Download the PDF file and submit with your code together.
a. Observe the plots in the PDF file, what looks odd based on the monthly trends
for all categories?
b. Use PROC FREQ to check the distribution of Date in the raw data CARD. Can you
guess the reason of the observation in part a?
;