Название: Exercises and Projects for The Little SAS Book, Sixth Edition
Автор: Lora D. Delwiche
Издательство: Ingram
Жанр: Программы
isbn: 9781642955255
isbn:
Programming Exercises
27. The body mass index (BMI) is a measure used as a rough indicator of an individual’s body fat. The following program computes BMI using weight (in pounds) and height (in inches).
** Compute Body Mass Index using pounds and
inches;
DATA bodymass;
Gender = ‘Male’;
Weight = 150;
Height = 68;
BMI = (Weight / Height ** 2) * 703;
RUN;
a. Type this program into the editor and submit it.
b. This program creates a SAS data set named BODYMASS in the WORK library. View the data set. Find the value that was calculated for the BMI variable and record this value as a comment in your program.
c. View the properties of the data set to identify the type of each variable and record them as comments in your program. How you view the properties varies depending on what SAS interface you are using.
d. Choose different values for the variables Weight and Height in your program. Add a PROC PRINT to list the data in the BODYMASS data set and submit the revised program.
28. SAS system options control many aspects of the way SAS runs. You can list the current values of system options using the OPTIONS procedure. You can change the value of system options using the OPTIONS statement.
a. Write a program that contains the OPTIONS procedure, and submit it.
b. In your SAS log, find the following options: MISSING=, OBS=, PAPERSIZE=, and YEARCUTOFF=. Add comments to your program stating the current values of these options.
c. Using an OPTIONS statement, change the option CENTER to NOCENTER. Then add another PROC OPTIONS to your program and submit the new SAS statements. Check your log to confirm that the option has been changed to NOCENTER.
29. The following DATA step attempts to create a SAS data set that contains information about a city.
OPTIONS NONUMBR;
DATA info;
City = ‘Sao Paulo’;
Country = ‘Brazil’
CountryCode = 55;
CityCode = 11;
RUN;
a. Type this program into SAS and submit it. Review the information in the SAS log. In a comment in your program, identify the number of notes, warnings, and errors produced by this code (not including any start-up messages).
b. Revise the code to fix the programming mistakes, and then resubmit it.
c. Review the information in the SAS log. In a comment in your program, identify how many observations and variables were created in this data set.
Chapter 2
Accessing Your Data
Multiple Choice
1. What type of data files are not considered raw data?
a. ASCII files
b. CSV files
c. Text files
d. SQL tables
2. In the SAS windowing environment, the Viewtable window is useful for which of the following actions?
a. Combining existing SAS data sets
b. Entering data into a SAS data set
c. Exporting data to another file type
d. Importing data from another file type
3. Which of the following is a valid libref name that can be used to create a permanent SAS data set?
a. working
b. 365days
c. permanent
d. All of the above
4. Which DATA statement will create a permanent SAS data set called DOGS assuming that all SAS libraries have been properly defined?
a. DATA dogs.sas7bdat;
b. DATA dogs;
c. DATA sasdata.dogs;
d. None of the above
5. When using the following direct reference to create a permanent SAS data set in the Windows operating environment, what does the name dogs refer to?
DATA ‘c:\MySASLib\dogs’;
a. The drive
b. The directory
c. The filename
d. The libref
6. The descriptor portion of a SAS data set includes which of the following?
a. The SAS engine with which the data set was created
b. The date on which the data set was created
c. The number of variables and observations
d. All of the above
7. Which optional statement in PROC IMPORT tells SAS to expect a column that contains both character and numeric values?
a. GETNAMES = NO
b. GETNAMES = YES
c. MIXED = NO
d. MIXED = YES
8. Which PROC IMPORT option identifies the type of Microsoft Excel file to be read?
a. DELIMITER=
b. DBMS=
c. DATAROWS=
d. None of the above
9. If your raw data file contains only data and no variable names, which PROC IMPORT option should you use?
СКАЧАТЬ