1.1 Flashcards
Which of the following is NOT needed to program in SAS?
a) an editor to write and submit code
b) a client application that runs on our PC and connects to SAS on a local or remote server
c) a way to read messages related to the code you submit (called a log in SAS)
d) a way to view the reports and data your program creates
b) In addition to SAS Enterprise guide which runs on a PC, SAS Studio is a web-based interface that connects to a SAS server. There is no download and it can be used on any computer.
Which of the following is NOT a tab SAS creates after running the program below?
data myclass;
set sashelp.class;
run;
proc print data=myclass;
run;
a) Code
b) Log
c) Results
d) My Libraries
d) SAS also creates Output Data tab, but does not create a tab for My Libraries. My Libraries can be found in the left navigation pane under Libraries if you are using SAS Studio.
Which of the following statements are false:
a) SAS Logs includes the program and messages returned from SAS.
b) SAS Logs can contain Errors, Warnings, or Notes
c) The new table created by a data step can be viewed in the Results tab.
d) By highlighting only a portion of the code, you can run only the selected portion of the program.
c) The new table can be viewed in the Output Data tab (SAS Studio). The Results tab shows reports created by the code (e.g. PROC PRINT)
How can you navigate to the SASHELP data sets in SAS Enterprise Guide?
a) In the lower left corner of the Servers window select: Servers > Local > Libraries > SASHELP
b) In the upper left corner of the Servers window select: MyServers > Libraries > My Libraries > SASHELP
c) In the lower left corner of the Servers window select: Libraries > Local > SASHELP
d) There is no way to view SASHELP libraries in SAS Enterprise Guide
a) In the lower left corner of the Servers window select: Servers > Local > Libraries > SASHELP
Which of the following keys can be used to run SAS programs?
a) F1
b) F2
c) F3
d) F4
c) F3
True/False - It is possible to view multiple tabs at the same time in SAS Studio and SAS Enterprise Guide.
True - To view more tabs at the same time, right-click the tab that you would like to view and select either Float, New vertical tab group, or New horizontal table group. You can also drag and drop tabs outside of Enterprise Guide in any location that you prefer.
Which of the following statements is true regarding SAS Program Structure?
a) There are two kinds of statements in SAS programs: the DATA statement and the PROC, or procedure, statement.
b) A SAS program can only contain DATA steps or PROC steps but not both.
c) DATA and PROC steps get their name from the keyword that begins the first statement in the step: DATA or PROC.
d) All SAS steps must end with a RUN statement. If you don’t use a RUN statement at the end of a step SAS will error.
c)
a) DATA and PROC are steps, not statements
b) SAS programs can contain any combination of DATA or PROC steps.
d) Some SAS steps end with a QUIT statement. If you don’t use a RUN statement at the end of a step, the beginning of a new DATA or PROC step signals the end of the previous step.
How many steps does the program below have:
data myclass;
set sashelp.class;
heightcm=height*2.54;
run;
proc print data=myclass;
run;
proc means data=myclass;
var age heightcm;
run;
a) 3
b) 2
c) 9
d) 1
a) There are three steps - one DATA and two PROC
Which of the following cannot be done with a SAS DATA step?
a) read data from an input source, processes it, and create a SAS table
b) filter rows
c) compute new columns
d) generate reports and graphs
d) PROC step is used to generate reports
True/False - All statements must be within either a DATA step or a PROC step.
False - a SAS program can also contain global statements such as TITLE, OPTIONS, and LIBNAME. These statements can be outside DATA and PROC steps, and they typically define some option or setting for the SAS session.
How many statements does the step below have?
proc sort data=mytable
out=newtable;
by mycol;
run;
a) 1
b) 4
c) 3
d) 2
c) All statements must end with a semicolon.
True/False - The program below will generate an error when run in SAS.
data myclass; set sashelp.class;run;
False - Spacing, line brakes, and indentation are not necessary for SAS programs to run, but they are recommended for readability.
Which of the options below will NOT successfully add a comment to a SAS program?
a) /* students under 13 years old /
b) /**under 13**/
c) –students under 13 years old
d) *students under 13 years old;
c) –students under 13 years old
True/False - comments are ignored when a SAS program runs.
True - you can use these comments to document your code or to suppress a portion of your code from executing. To comment out a single statement ending in a semicolon you add an asterisk at the beginning of the statement. To comment out multiple lines of code you add /* at the beginning and */ at the end of the text you want to comment out.
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) four