Hi all,
In SAS Certification Prep Guide: Base Programming for SAS9 4th edition, there is a quiz question in ch 12:
6.Assuming that the data set Sasuer.Usa has five or more observations, what is the result of submitting the following program?
data work.getobs5;
obsnum=5;
set sasuser.usa(keep=manager payroll) point=obsnum;
output;
stop;
run;
a.an error
b.an empty data set
c.a continuous loop
d.a data set that contains one observation
I was convinced that "d" is the correct answer, but answer says:
"6. Correct answer: a
When you use the KEEP= data set option and the POINT= option with the OUTPUT
and STOP statements, your program cannot write out a single observation."
My question is why this this program doesn't output exactly 1 observation?
Thanks
d) has to be the correct answer, as this log shows:
27 data work.getobs5; 28 obsnum=5; 29 set sashelp.class (keep=name age) point=obsnum; 30 output; 31 stop; 32 run; NOTE: The data set WORK.GETOBS5 has 1 observations and 2 variables. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds
d) has to be the correct answer, as this log shows:
27 data work.getobs5; 28 obsnum=5; 29 set sashelp.class (keep=name age) point=obsnum; 30 output; 31 stop; 32 run; NOTE: The data set WORK.GETOBS5 has 1 observations and 2 variables. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds
Also, the book's explanation for the "correct answer" is anything but convincing. It's not the only error in that edition: see, e.g., SAS Prep Guide SAS 9 4th edition question on Ch 13 quiz.
There is, however, a possibility of getting both an error (a) and an empty data set (b): if sasuser.usa does not contain variables manager and payroll. In addition, the assumption "has five or more observations" was made about a different dataset: Sasuer.Usa.
Now i see that libref in question (sasuer) and libref in code (sasuser) are different. But i believe it is a typo.
Yeah, there is a lot of mistakes in quiz, even if you include errata:
https://support.sas.com/en/books/content-updates-base-prep-guide-4th-edition.html
I just hope that real exam will not have those errors.
This is a knowledge-sharing community for SAS Certified Professionals and anyone who wants to learn more about becoming SAS Certified. Ask questions and get answers fast. Share with others who are interested in certification and who are studying for certifications.To get the most from your community experience, use these getting-started resources:
Community Do's and Don'ts
How to add SAS syntax to your post
How to get fast, helpful answers
Ready to level-up your skills? Choose your own adventure.