ТОП просматриваемых книг сайта:
Exercises and Projects for The Little SAS Book, Sixth Edition. Lora D. Delwiche
Читать онлайн.Название Exercises and Projects for The Little SAS Book, Sixth Edition
Год выпуска 0
isbn 9781642955255
Автор произведения Lora D. Delwiche
Жанр Программы
Издательство Ingram
a. Results Viewer
b. Output window
c. Results window
d. Viewtable window
13. If a program does not run correctly, where can you find the error messages?
a. The end of the program
b. The log
c. The results
d. The output
14. When you submit a SAS program in an interactive environment, which window or tab will always show activity?
a. Enhanced Editor
b. Log
c. Results
d. Output
15. Which of the following is true about OPTIONS statements?
a. They are specified in DATA steps
b. They are global
c. These statements modify your default settings for future SAS sessions
d. The first OPTIONS statement in a program overrides subsequent ones
16. Suppose you submit the following code. Any output formatted for printing that is created after this statement will have what characteristics?
OPTIONS NUMBER NOCENTER;
a. Left-justified with no page numbers and no date
b. Left-justified with no page numbers with today’s date
c. Left-justified with page numbers and no date
d. Left-justified with page numbers with today’s date
Short Answer
17. Would the layout of the following PROC PRINT code cause SAS to produce an error? Explain why or why not, and rewrite the code so that it is more organized.
PROC
DATA = new; RUN;
18. SAS ignores anything inside a comment. Explain why it is a good idea to add comments to your program.
19. Suppose that you need to record information on the annual salary of employees as a variable in a SAS data set. Would it be better to store this information as a character or numeric variable? Explain your choice.
20. A coworker tells you, “SAS programs always start with a DATA step.” Is this true? Explain why or why not.
21. Explain why SAS data sets are self-documenting.
22. Which will occur first: execution of the last statement in the DATA step or reading of the last observation in an input data set? Explain your choice.
23. Explain in what order SAS processes observations in a DATA step.
24. Explain why it is a good idea to check your SAS log.
25. Describe what a global statement is and identify two such statements.
26. Explain why using the OPTIONS statement is the most flexible way to specify a system option.
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