|
-
How many step boundaries does this program contain?
data work.staff;
length First_Name $ 12
Last_Name $ 18
Job_Title $ 25;
infile "&path\newemployees.csv"
dlm=',';
input First_Name $ Last_Name$
Job_Title $ Salary;
run;
proc print data=work.staff;
run;
proc means data=work.staff;
var Salary;
run;
a. |
four |
b. |
five |
c. |
six |
d. |
seven |
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.
|
|
-
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.
|
e. |
Put a RUN statement after every DATA or PROC step.
|
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 |
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 text incorrectly begins on line one. |
d. |
Yes. The comment contains a semicolon, which causes an error message. |
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. |
an HTML report of the work.newsalesemps data set |
b. |
an error message in the log |
c. |
a LISTING report of the work.newsalesemps data set |
d. |
the creation of a temporary data set called work.newsalesemps |
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.
|
|
-
When you submit a program containing unbalanced quotation marks in SAS Enterprise Guide, you can simply correct the error and resubmit the program.
SAS keeps a running total of the number of quotation marks in your code. In the windowing environment, an odd number of quotation marks would cause the program to hang; you would have to stop the program before adding the missing quotation mark and resubmitting the program. In contrast, SAS Enterprise Guide automatically adds wrapper code that programmatically balances quotations marks to prevent your program from hanging.
|
|
-
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 the keyword PROC is misspelled and executes the PROC PRINT step.
|
The log will indicate that SAS assumed that the keyword PROC was misspelled, corrected it temporarily, and executed the PROC step.
|
|
-
Suppose you submit the DATA step below in a SAS windowing environment. If the active window displays the message DATA step running for a long time, what probably happened?
data work.groups;
set sashelp.class;
if age < 13 then group = 'Pre-teen';
else group = 'Teen';
a. |
You misspelled a keyword. |
b. |
You forgot to end the DATA step with a RUN statement. |
c. |
You specified an invalid data set option. |
d. |
Some data values were not appropriate for the SAS statements that you specified.
|
Without a RUN statement (or a following DATA or PROC step), the DATA step doesn't execute. Unbalanced quotation marks can also cause the DATA step running message if relatively little code follows the unbalanced quotation mark. The other three problems above generate errors in the Log window.
|
|
-
Suppose that this program contains no errors. What happens when you submit the program in the SAS windowing environment?
proc print data=work.sales;
run;
a. |
Messages appear in the Log window, and the Explorer window moves to the front.
|
b. |
Any HTML output appears in the Output window or a browser window, and any LISTING output appears in the Results Viewer window.
|
c. |
Any HTML output appears in the Results Viewer window or a browser window, and any LISTING output appears in the Output window.
|
All SAS programs generate log messages. This program creates a PROC PRINT report and moves the Results window to the front. The output appears in the corresponding window (the Output window for LISTING output, or the Results Viewer or browser window for HTML output).
|
|
- Which of the following is a true statement about SAS output?
a. |
SAS Enterprise Guide 5.1 displays Text or LISTING output by default.
|
b. |
SAS Enterprise Guide 5.1 displays HTML output by default.
|
c. |
SAS 9.3 in the windowing environment displays LISTING output by default.
|
d. |
SAS 9.3 in the windowing environment displays HTML output by default.
|
SAS Enterprise Guide 5.1 creates SAS Report output by default; you can change the default output format and select additional output formats by selecting Tools, Options, Results, Results General. Other result formats that are available in SAS Enterprise Guide 5.1 include HTML, PDF, RTF, and Text or LISTING output. In the windowing environment, SAS 9.3 displays HTML output in the Results Viewer by default. You can choose to have SAS display LISTING output in addition to or instead of HTML output. To change the result format, select Tools, Options, Preferences, and click the Results tab.
|