1: Essentials Flashcards
How many steps does this program contain? data national; set sashelp.baseball; BatAvg=nHits/nAtBat; run;
proc contents data=national;
run;
proc print data=national;
run;
proc means data=national;
var BatAvg;
run;
a. one b. two c. four d. eight
C
RUN, QUIT, DATA, and PROC statements function as step boundaries, which determine when SAS statements take effect and indicate the end of the current step or the beginning of a new step.
Running a SAS program can create which of the following?
a. log b. output data c. results d. all of the above
D
A SAS program always creates a log. A program can create output data and results as well, depending on the steps included.
Which of the following is a SAS syntax requirement?
a. Begin each statement in column one. b. Put only one statement on each line. c. Separate each step with a line space. d. End each statement with a semicolon.
D
All SAS statements must end with a semicolon, but they are free-format. You can begin or end them anywhere, separate steps with line spaces, and optionally end steps with a RUN statement.
Which of the following steps is typically used to generate reports and graphs?
a. DATA b. PROC c. REPORT d. RUN
B
PROC steps are typically used to process SAS data sets (that is, generate reports, graphs, and statistics).
Does this comment contain syntax errors? /* Report created for budget presentation; revised October 15. */ proc print data=work.newloan; run;
a. No. The comment is correctly specified.
b. Yes. Every comment line must end with a
semicolon.
c. Yes. The comment is on more than one line.
d. Yes. There is a semicolon in the middle of the
comment.
A
A block comment can contain semicolons and unbalanced quotation marks, can appear anywhere, and doesn’t need a semicolon at the end.
What result would you expect from submitting this step?
proc print data=work.newsalesemps
run;
a. a report of the work.newsalesemps data set b. an error message in the log c. the creation of a table named work.newsalesemps
B
There is a missing semicolon following the data set name. When this step runs, SAS will interpret the word run as an option in the PROC PRINT statement (because of the missing semicolon). As a result, the PROC PRINT step will not execute and an error message will be displayed in the log.
What happens if you submit the following program?
porc print data=work.newsalesemps;
run;
a. SAS does not execute the step. b. SAS assumes that PROC is misspelled and executes the step.
B
The log will indicate that SAS assumed that the keyword PROC was misspelled, corrected it temporarily, and executed the PROC step.
This program contains a syntax error because National is in different cases. data national; set sashelp.baseball; BatAvg=nHits/nAtBat; run;
proc means data=NATIONAL;
var BatAvg;
run;
a. True b. False
B
Case does not matter in unquoted values, so in this case, the data set name can be specified in any case.
How many statements does this program contain?
*Create a cars report;
title “European Cars Priced Over 30K”;
footnote “Internal Use Only”;
proc print data=sashelp.cars; where Origin='Europe' and MSRP>30000; var Make Model Type Mpg_City Mpg_Highway; run;
a. five b. six c. seven d. eight
C
This program contains seven statements (seven semicolons): comment, TITLE, FOOTNOTE, PROC, WHERE (two lines), VAR (two lines), and RUN.
Which of the following is not a SAS programming interface?
a. SAS Enterprise Guide b. SAS Manager c. SAS Studio d. SAS windowing environment
B
The programming interfaces include SAS Enterprise Guide (client application), SAS Studio (web-based), and SAS windowing environment. There is not an interface or product named SAS Manager.