22S:166 Computing in Statistics Homework 4 for Kate Cowles Due 10/29/01 1. Download the SAS program createbooks.sas from the course web page. This program creates the dataset on year-to-date sales of computer books that was used in lecture examples on 10/19. 2. Add a libname statement at the beginning of the program to direct the permanent dataset to be saved in the directory of your choice. 3. Write a macro that can create tables in the format shown below. The macro must have two arguments, one to indicate by which categorical variable (if any) to break down the table, and one to indicate for which quantitative variables to present a count and a sum. 4. Run your macro three times to produce the output shown below. 5. Turn in your SAS code for defining and calling the macro (but not for the data step that simulates the dataset), and turn in your output. Hint: Your macro may need a conditional statement similar to the following: %if &classvar ne %then %do; &classvar all, %end; Sales Year-to-Date 1 ------------------------------------------------------------------------ | | Wholesale Cost | Sale Price | List Price | | |-----------------+-----------------+-----------------| | | N | Sum | N | Sum | N | Sum | |----------------+-----+-----------+-----+-----------+-----+-----------| |Section | | | | | | | |----------------| | | | | | | |Internet | 1777| $39,120.49| 1777| $53,998.95| 1777| $55,249.15| |----------------+-----+-----------+-----+-----------+-----+-----------| |Networks and | | | | | | | |Communication | 649| $14,088.14| 649| $19,472.97| 649| $19,906.55| |----------------+-----+-----------+-----+-----------+-----+-----------| |Operating | | | | | | | |Systems | 1877| $41,250.45| 1877| $56,964.04| 1877| $58,245.15| |----------------+-----+-----------+-----+-----------+-----+-----------| |Programming | | | | | | | |Languages | 900| $19,419.75| 900| $26,830.81| 900| $27,435.00| |----------------+-----+-----------+-----+-----------+-----+-----------| |Web Design | 1756| $38,611.04| 1756| $53,321.45| 1756| $54,544.20| |----------------+-----+-----------+-----+-----------+-----+-----------| |All | 6959|$152,489.86| 6959|$210,588.22| 6959|$215,380.05| ------------------------------------------------------------------------ Sales Year-to-Date 2 ------------------------------------------------------ | | Wholesale Cost | Sale Price | | |-----------------+-----------------| | | N | Sum | N | Sum | |----------------+-----+-----------+-----+-----------| |Sales Person | | | | | |Initials | | | | | |----------------| | | | | |BLT | 2794| $61,085.83| 2794| $84,299.05| |----------------+-----+-----------+-----+-----------| |JMB | 2340| $51,410.80| 2340| $71,022.12| |----------------+-----+-----------+-----+-----------| |MJM | 1825| $39,993.22| 1825| $55,267.05| |----------------+-----+-----------+-----+-----------| |All | 6959|$152,489.86| 6959|$210,588.22| ------------------------------------------------------ Sales Year-to-Date 3 ------------------------------------------------------- | Wholesale Cost | Sale Price | List Price | |-----------------+-----------------+-----------------| | N | Sum | N | Sum | N | Sum | |-----+-----------+-----+-----------+-----+-----------| | 6959|$152,489.86| 6959|$210,588.23| 6959|$215,380.05| -------------------------------------------------------