STAT:5400 Computing in Statistics Fall 2017, Instructor: Cowles Homework 8 Due: Wed. 11/15 The following datasets are available under "Datasets" on the course web page. Cars.dat countries.dat Here is a description of the Cars.dat data file: Description: Measurements on 38 1978-79 model automobiles. The gas mileage in miles per gallon as measured by Consumers' Union on a test track. Other values as reported by automobile manufacturer. Number of cases: 38 Variable Names: Country: Nationality of manufacturer (eg. U.S., Japan) Car: Car name (Make and model) MPG: Miles per gallon, a measure of gas mileage Drive_Ratio: Drive ratio of the automobile Horsepower: Horsepower Displacement: Displacement of the car (in cubic inches) Cylinder: Number of cylinders The "countries.dat" data file has only two variables: country: Name of country capital: Name of capital city Hint: Here is part of a data step to read the "countries.dat" data file. You may include this code in your program. You will have to either complete the "infile" statement or put the data into "datalines" yourself. data countries ; infile ; length Country $11. capital $15. ; input Country capital ; run ; ------------------------------------------------------------------------- Write a SAS macro that will produce one of the kinds of tables given below. Whichever one you choose, your macro should list the capital city of the country, the number of cars in the Cars.dat file that were manufactured in the country, and the minimum, median, and maximum values of one variable describing the cars manufactured in the country. The macro should let you specify different variables in different calls. In the examples below, I called my macros with the MPG variable, but I could also have used any of the other quantitative variables (drive_ratio, horsepower, displacement, or cylinders). Countries that appear in the "countries.dat" file but that have no cars in the "Cars.dat" file should not appear in the table. In the SAS output that you turn in along with your code, show output from calling your macro for two different variables. ------------------------------------------------------------------------------ The MEANS Procedure Analysis Variable : MPG N Capital city Obs Minimum Median Maximum ---------------------------------------------------------------------- Berlin 5 20.3 30.5 31.9 Paris 1 16.2 16.2 16.2 Rome 1 37.3 37.3 37.3 Stockholm 2 17.0 19.3 21.6 Tokyo 7 22.0 29.5 35.1 Washington D.C. 22 15.5 20.7 34.2 ---------------------------------------------------------------------- ---------------------------------------------------------------------- | | MPG | | |---------------------------------------------------| | | N | Min | Median | Max | |----------------+------------+------------+------------+------------| |Capital city | | | | | |----------------| | | | | |Berlin | 5.00| 20.30| 30.50| 31.90| |----------------+------------+------------+------------+------------| |Paris | 1.00| 16.20| 16.20| 16.20| |----------------+------------+------------+------------+------------| |Rome | 1.00| 37.30| 37.30| 37.30| |----------------+------------+------------+------------+------------| |Stockholm | 2.00| 17.00| 19.30| 21.60| |----------------+------------+------------+------------+------------| |Tokyo | 7.00| 22.00| 29.50| 35.10| |----------------+------------+------------+------------+------------| |Washington D.C. | 22.00| 15.50| 20.70| 34.20| ---------------------------------------------------------------------- Submit your solutions in two files in ICON. Copy your complete SAS program, including all data steps, macro definition, and macro calls, into a text file, and submit through ICON. The output (tables only) may be submitted in .pdf, .html, .rtf, or .txt.