About The Authors
Rebecca A. Ottesen first learned SAS as a student at California Polytechnic State University, San Luis Obispo, where she now teaches for the Statistics Department. As a biostatistician for the City of Hope, Rebecca uses every opportunity to incorporate her research and programming experience into the coursework for her Cal Poly students.
Lora D. Delwiche enjoys teaching people about SAS software and likes solving challenging problems using SAS. She has spent most of her career at the University of California, Davis, using SAS in support of teaching and research.
Susan J. Slaughter discovered SAS software in graduate school at North Carolina State University. Since then, she has used SAS in a variety of business and academic settings managing large databases, teaching SAS software classes, and helping other SAS programmers. She now works as a consultant through her company, Avocet Solutions.
Learn more about these authors by visiting their author pages, where you can download free book excerpts, access example data, read the latest reviews, get updates, and more:
support.sas.com/ottesen support.sas.com/delwiche support.sas.com/slaughter
Acknowledgments
1. Which of the following is true about the technical reviewers, editors, designer, technical publishing specialist, and marketing specialist for this book?
a. They are smart
b. They are hard-working
c. They are wonderful
d. All of the above
The correct answer is D! We are grateful to have had the support of so many insightful people who contributed to this book. Our reviewers (Marie Boman-Davis, Hunter Glanz, Lynette Harris, Laura Kapitula, Isabel Litton, Sanjay Matange, Lelia McConnell, Sandy Owens, and Christine Wells) provided us with invaluable feedback and perspective that helped us shape this book so that it will develop important skills for beginning programmers. Robert Harris, our cover designer, made all of our cover ideas come to life. Our technical publishing specialist, Denise Jones, ensured that the final version of the book looked great. To Sian Roberts, our marketing specialist, thank you for helping to promote our book and getting the word out. We offer a special thank you to Catherine Connolly, our developmental editor and copyeditor, for hanging in there and standing by our side every step of the way. And, finally, this book would also not have been possible without the support of our families, friends, loyal readers, and students (you know who you are), thank you.
Chapter 1
Getting Started Using SAS Software
Multiple Choice
1. Which of the following is not a comment in SAS?
a. /* I am not a comment */
b. * I am not a comment ;
c. /* * I am not a comment; */
d. All of the above are valid comments
2. What other term is appropriate for referring to a SAS data set?
a. A column
b. A row
c. A table
d. None of the above
3. Which of the following is a valid variable name when using the VALIDVARNAME=V7 option?
a. AbCdEfGhIjKlMnOpQrStUvWxYz
b. %Change
c. Debt-Ratio
d. 1stProcedure
4. In SAS data sets, missing numeric data are represented by which of the following?
a. A single space
b. A single period
c. Any number of spaces
d. Any of the above
5. What is the main difference in the naming convention for SAS data libraries versus SAS variables?
a. SAS data library names can contain special characters such as $, % and #
b. Variable names are case sensitive
c. SAS data library names can only be up to 8 characters long
d. Variable names can contain underscores
6. What is a SAS data library?
a. A location where SAS data sets are stored
b. A location where the SAS log messages are stored
c. A location where SAS procedure results are stored
d. All of the above
7. How many SAS statements does this program contain?
DATA instock; INFILE supply;
INPUT Brand $
Model $
Quantity;
RUN;
PROC PRINT DATA = instock;
RUN;
a. 2
b. 3
c. 6
d. 7
8. Which statement does not indicate the end of a DATA or PROC step?
a. STOP
b. QUIT
c. END
d. RUN
9. By default, SAS will execute the DATA step one time each for which of the following?
a. Variable
b. Observation
c. Data set
d. Procedure
10. Which of the following is not an interactive environment for editing and submitting SAS programs?
a. SAS windowing environment
b. SAS Studio
c. SAS Enterprise Guide
d. Batch mode
11. What will the value of F be in the data set called TEMPS?
DATA temps;
F = (C * 9/5) + 32;
C = 0;
RUN;
a. .
b. 0
c. 32
d. 34
12. In the SAS windowing environment, you can edit SAS data