Here’s a simple SAS Problem to work with…
This was presented at a technical interview screening at Gap Inc….
For the following 7 questions we are working with a temporary database called PRODUCT Each record is a product transaction along with the following information:
Store number 0-9
Date of the transaction
‘B’ if the product was Bought or ‘S’ if it was sold
# of units transacted
Please answer the following questions using this database:
Assume that the data is loaded into memory as WORK.PRODUCT, write a program that lists by Store, the following information: Store; products bought; total cost per product. Create a table called work.totalbuy.
We have just been told that there is an error in the data. There can only be products sold after a product has been bought for any one store. Clean the data and output any errors to work.errors.
Write a macro that for each store would create a file work.STOREx (where x = the store number). The file should have data that summarizes information across products.
Use Proc Freq to determine what products are being bought across all stores. Store this information in work.prodbuy.
Do number 4 again without using Proc Freq but using a different procedure.
Do number 4 again using the data step and not the procedure used in 4 and 5.
Using WORK.PRODUCT output a dataset that contains the a record for the each store with the earliest purchase date for each product; the earliest sale date for each product; and the total profit for each product.