Question
1. The manager of the bookstore wants to know which sales rep sold the most books in 2014 . Use one or PROC SQL to
1. The manager of the bookstore wants to know which sales rep sold the most books in 2014. Use one or PROC SQL to find out. In the final table to present to the manager, include sales rep's name and the number of books sold in 2014. Also make sure the name shows up as first initial, space, and last name.Such As 'J Smith'. There may need to involve more than 2 datasets.
The below table contains the list of all six (6) datasets and their individual variables. Bolded variable names represent common variables with other datasets.
This is the code I've created so far but am struggling to format the name in the requested format. Please advise if code is accurate and how to format name.
proc sql; create table BestSalesRep as select S.name, count(I.quantity) as total_books from _TEMP1.ORDERS as O inner join _TEMP1.ITEMS as I on O.orderno = I.orderno inner join _TEMP1.SALESREP as S on S.salesid = O.salesid where year(O.dateord) = 2014 group by S.salesid order by total_books desc; quit; proc print data=BestSalesRep (obs=1); run;
Customers | Items | List | Orders | Prices | SalesRep |
fname | orderno | bookid | salesid | bookid | id |
lname | bookid | title | custid | datefirst | name |
address1 | dateship | author | orderno | price | salesid |
city | quantity | author2 | dateord | datelast | |
stcode | yearpub | ||||
zip | isbn | ||||
custid | |||||
phone |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started