1.1 Flashcards

1
Q

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

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

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

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

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.

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

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

a) In the lower left corner of the Servers window select: Servers > Local > Libraries > SASHELP

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which of the following keys can be used to run SAS programs?

a) F1
b) F2
c) F3
d) F4

A

c) F3

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

True/False - It is possible to view multiple tabs at the same time in SAS Studio and SAS Enterprise Guide.

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

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.

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

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

a) There are three steps - one DATA and two PROC

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

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

A

d) PROC step is used to generate reports

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

True/False - All statements must be within either a DATA step or a PROC step.

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

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

A

c) All statements must end with a semicolon.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

True/False - The program below will generate an error when run in SAS.

data myclass; set sashelp.class;run;

A

False - Spacing, line brakes, and indentation are not necessary for SAS programs to run, but they are recommended for readability.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

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;

A

c) –students under 13 years old

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

True/False - comments are ignored when a SAS program runs.

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

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

A

c) four

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Running a SAS program can create which of the following?

a) log
b) output data
c) results
d) all of the above

A

d) all of the above

17
Q

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.

A

d) End each statement with a semicolon.

18
Q

Does this comment contain syntax errors?
/*
Report created for budget presentation; revised October 15.
*/

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) No. The comment is correctly specified.

19
Q

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 name work.newsalesemps

A

b) an error message in the log (missing ; after first statement)

20
Q

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.

A

b) SAS assumes the PROC misspelled and executes the step.

21
Q

True/False - 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

False

22
Q

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>3000;
   var Make Model Type Mpg_City Mpg_Highway;
run;

a) five
b) six
c) seven
d) eight

A

c) seven - the program contains seven statements (seven semicolons): comment, TITLE, FOOTNOTE, PROC, WHERE (two lines), VAR (two lines), and RUN

23
Q

Which of the following is not a SAS programming interface?

a) SAS Enterprise Guide
b) SAS Manager
c) SAS Studio
d) SAS windowing environment

A

b) SAS Manager