Getting Started with SAS Programming Quiz

Getting Started with SAS Programming Quiz Answer. In this post you will get Quiz Answer Of Getting Started with SAS Programming

 

Getting Started with SAS Programming Quiz

Offered By ”SAS”

Enroll Now

Week- 1

Essentials

1.
Question 1
How many steps does this program contain?

14
data national;
set sashelp.baseball;
BatAvg=nHits/nAtBat;
run;

proc contents data=national;
run;

proc print data=national;
run;

1 point

  • four
  • eight
  • one
  • two

=================================================

 

2.
Question 2
Running a SAS program can create which of the following? Select all that apply.

1 point

  • log
  • output data
  • results

=================================================

 

3.
Question 3
Which of the following is a SAS syntax requirement?

1 point

  • Separate each step with a line space.
  • Begin each statement in column one.
  • End each statement with a semicolon.
  • Put only one statement on each line

=================================================

 

4.
Question 4
Which of the following steps is typically used to generate reports and graphs?

1 point

  • DATA
  • PROC
  • REPORT
  • RUN

=================================================

 

5.
Question 5
Does this comment contain syntax errors?

1234567
/*
Report created for budget
presentation; revised October 15.
*/
proc print data=work.newloan;
run;

1 point

  • Yes. The comment is on more than one line.
  • Yes. There is a semicolon in the middle of the comment.
  • Yes. Every comment line must end with a semicolon.
  • No. The comment is correctly specified.

=================================================

 

6.
Question 6
What result would you expect from submitting this step?

123
proc print data=work.newsalesemps
run;

1 point

  • a report of the work.newsalesemps data set
  • an error message in the log
  • an output table named work.newsalesemps

=================================================

 

7.
Question 7
What happens if you submit the following program?

123
porc print data=work.newsalesemps;
run;

1 point

  • SAS does not execute the step.
  • SAS assumes that PROC is misspelled and executes the step.

=================================================

 

8.
Question 8
This program contains a syntax error because National is in different cases.

123456789
data national;
set sashelp.baseball;
BatAvg=nHits/nAtBat;
run;

proc means data=NATIONAL;
var BatAvg;
run;

1 point

  • True
  • False

=================================================

 

9.
Question 9
How many statements does this program contain?

123456789101112
*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;

1 point

  • five
  • six
  • seven
  • eight

Week- 2

Accessing Data

1.
Question 1
In this PROC CONTENTS output, what is the default length of the Birth_Date column?

# Variable Type
4 Birth_Date Num
3 Customer_Address Char
1 Customer_ID Num
2 Customer_Name Char

1 point

It doesn’t have a default length

4 bytes

32,767 bytes

8 bytes

=================================================

 

2.
Question 2
Which LIBNAME statement has the correct syntax?

1 point

libname reports “filepath/workshop”;

libname orion filepath/workshop;

libname 3456a “filepath/workshop”;

=================================================

 

3.
Question 3
Which of the following tables is available at the beginning of a new SAS session?

1 point

sales

work.newsalesemps

sashelp.class

=================================================

 

4.
Question 4
In this table, what type of column is Employee_ID?

Obs Employee_ID Last Salary
1 . Ralston 29250
2 120101 Lu 163040
3 120104 Billington 46230
4 120105 Povey 27110
5 120106 Hornsey .
1 point

character

numeric

temporary

missing

=================================================

 

5.
Question 5
Which statement about SAS dates is false?

1 point

A SAS date is one of three SAS column types: numeric, character, and date.

SAS date values can be positive or negative.

SAS date values can be used in calculations.

SAS dates represent the number of days from January 1, 1960.

=================================================

 

6.
Question 6
Which LIBNAME statement has the correct syntax for reading a Microsoft Excel file?

1 point

libname mydata xlsx “filepath/field_data.xlsx”;

libname excel “filepath/myexcelfile”;

libname mydata xlsx “filepath/myexcelfile”;

=================================================

 

7.
Question 7
Which library name (libref) is valid?

1 point

2010car

car/2010

car2010

cars_2010

=================================================

 

8.
Question 8
To disassociate a libref that you previously assigned, you can use the UNASSIGN option in the LIBNAME statement.

1 point

True

False

=================================================

 

9.
Question 9
What does this code do?

123
proc import datafile=”d:/collect817/bird_count.csv”
dbms=csv out=bird817 replace;
run;
1 point

It uses the CSV engine to directly read the data file bird_count.csv.

It creates a SAS data set named bird817 in the work library from the CSV file bird_count.

It creates a SAS data set named bird817 in the work library from the CSV file bird_count and replaces bird817 whenever the CSV file is updated.

=================================================

 

10.
Question 10
In which portion of a SAS data set are the following found?

name of the data set
type of the column Salary
creation date of the data set

1 point

descriptor portion

data portion

 

 

Week- 3

Exploring and Validating Data

1.
Question 1
Based on the following program and data, how many rows will be included in the dups table?

1234
proc sort data=payment dupout=dups nodupkey;
by ID;
run;

ID Amount
A $997.54
A $833.88
B $879.05
C $894.77
C $894.77
C $998.26

1 point

6

1

3

5

=================================================

 

2.
Question 2
Which of the following FORMAT statements was used to create this output?

Obs Order_ID Order_Date Delivery _Date
1 1230058123 11JAN07 01/11/07
2 1230080101 15JAN07 01/19/07
3 1230106883 20JAN07 01/22/07
4 1230147441 28JAN07 01/28/07
5 1230315085 27FEB07 02/27/07
1 point

format Order_Date date7. Delivery_Date mmddyy8.;

format Order_Date date9. Delivery_Date mmddyy8.;

format Order_Date monyy7. Delivery_Date mmddyy8.;

format Order_Date ddmmmyy. Delivery_Date mmddyy8.;

=================================================

 

3.
Question 3
The format name must include a period delimiter in the FORMAT statement.

1 point

True

False

=================================================

 

4.
Question 4
Which row or rows will be selected by the following WHERE statement?

where Job_Title like “Sales%”;

Obs Last_Name First_Name Country Job_Title
1 Wu Christine AU Sales Rep 1
2 Stone Kimiko AU Sales Manager
3 Hoffman Fred AU Insurance Sales
1 point

row 1

rows 1 and 2

row 2

row 3

all rows

=================================================

 

5.
Question 5
Which statement about this PROC SORT step is true?

1234
proc sort data=orion.staff;
out=work.staff;
by descending Salary Manager_ID;
run;
1 point

The sorted table overwrites the input table.

The sorted table contains only the columns specified in the BY statement.

The rows are sorted by Salary in descending order, and then by Manager_ID in descending order.

A semicolon should not appear after the input data set name.

=================================================

 

6.
Question 6
Which of the following statements selects from a table only those rows where the value of the column Style is RANCH, SPLIT, or TWOSTORY?

1 point

where Style in ‘RANCH’ or ‘SPLIT’ or ‘TWOSTORY’;

where Style in (‘RANCH’, ‘SPLIT’, ‘TWOSTORY’);

where Style in (RANCH, SPLIT, TWOSTORY);

where Style=’RANCH’ or ‘SPLIT’ or ‘TWOSTORY’;

=================================================

 

7.
Question 7
Which of the following statements selects rows in which Amount is less than or equal to $5,000 or Rate equals 0.095?

1 point

where amount <= 5000 or rate=0.095;

where amount le 5000 or rate=0.095;

where amount <= 5000 or rate eq 0.095;

all of the above

=================================================

 

8.
Question 8
Which statement creates the macro variable flower and assigns the value Plumeria?

1 point

%let &flower=”Plumeria”;

%let flower=Plumeria;

%let flower=”Plumeria”;

%let &flower=Plumeria;

=================================================

 

9.
Question 9
Which statement in a PROC MEANS step lets you specify the numeric columns to analyze?

1 point

TABLES

KEEP=

VAR

VARS

=================================================

 

10.
Question 10
Suppose you have a table that includes flower sales to all your retail outlets. You want to see the distinct values of Flower_Type with a count and percentage for each. Which procedure would you use?

1 point

PRINT

MEANS

FREQ

UNIVARIATE

 

 

Week- 4

Preparing Data

1.
Question 1
In which phase does the DATA step check for syntax errors?

1 point

compilation

execution

=================================================

 

2.
Question 2
Which statement is used to read a SAS data set in a DATA step?

1 point

SET statement

assignment statement

DATA statement

WHERE statement

=================================================

 

3.
Question 3
To process an Excel file with the DATA step, you must first create a copy of the data as a SAS table.

1 point

True

False

=================================================

 

4.
Question 4
What is the name of the output data set in the program below?

1234
data work.us;
set orion.sales;
where Country=’US’;
run;
1 point

work.us

orion.sales

sales

Country

=================================================

 

5.
Question 5
The data set orion.sales contains nine columns. Given this DATA step, how many columns does work.comp have?

1234
data work.comp;
set orion.sales;
keep employee_id status job_title salary;
run;
1 point

four

nine

five

=================================================

 

6.
Question 6
Given the assignment statement below, what is the value of AvgExp for the observation that is shown?

AvgExp=mean(Exp1, Exp2, Exp3, Exp4);

Exp1 Exp2 Exp3 Exp4
10 . 5 9
1 point

8

The statement generates a syntax error.

6

. (missing value)

=================================================

 

7.
Question 7
Which of the following SAS functions returns a number from 1 to 12?

1 point

YEAR(SAS-date-value)

MONTH(SAS-date-value)

WEEKDAY(SAS-date-value)

none of the above

=================================================

 

8.
Question 8
In the program below, what is the value of Credit if Country is ‘au’?

123456
data work.bonus;
set orion.sales;
if Country=’US’ then Credit=300;
else if Country=’AU’ then Credit=500;
else Credit=0;
run;
1 point

0

500

missing

300

=================================================

 

9.
Question 9
What is the length of the Car_Type column created in this program?

623451
data car_type;
set sashelp.cars;
if msrp>80000 then car_type=”luxury”;
else car_type=”regular”;
length car_type $ 8;
run;
1 point

6

7

8

=================================================

 

10.
Question 10
Use a DO group in a DATA step when you want to execute multiple statements for a true IF-THEN expression.

1 point

True

False

 

 

Week- 5

Analyzing and Reporting on Data

1.
Question 1
When you run this program, which title or titles appear in the final PROC PRINT results?

10
title1 ‘The First Line’;
title2 ‘The Second Line’;
proc print data=sales;
run;
title2 ‘The Next Line’;
proc print data=sales;
run;
title ‘The Top Line’;
proc print data=sales;
run;
1 point

The Top Line

The Top Line

The Next Line

The Top Line

The Second Line

The Top Line

The First Line

The Next Line

=================================================

 

2.
Question 2
Which statement substitutes the value of the macro variable Year in the footnote?

%let Year=2018;

1 point

footnote “%year Sales”;

footnote ‘&year Sales’;

footnote “&year Sales”;

footnote ‘year Sales’;

=================================================

 

3.
Question 3
Which statement is true based on the given program?

1234567891011121314
data baseball2;
set sashelp.baseball;
BatAvg=CrHits/CrAtBat;
label BatAvg=”Batting Average”;
run;

proc print data=baseball2;
var Name Team BatAvg;
run;

1 point

The label for BatAvg will appear in the PROC MEANS report.

The label for BatAvg will appear in both reports.

The column BatAvg will have a permanent label in the sashelp.baseball data set.

The label for BatAvg will appear in the PROC PRINT report.

=================================================

 

4.
Question 4
Which statement is true regarding a BY statement in a reporting procedure such as PROC PRINT?

1 point

The BY statement is responsible for sorting the table.

Only one column can be specified in the BY statement.

The BY statement must be the first statement after the PROC statement.

The BY statement groups the report by the specified columns.

=================================================

 

5.
Question 5
Which statement is false concerning the FREQ procedure?

1 point

The ORDER=FREQ option can be placed in the PROC FREQ statement to display the column values in descending frequency count order.

The PLOTS= option can be placed in the TABLES statement after the forward slash to create bar charts based on counts or percentages.

The OUT= option can be placed in the TABLES statement after the forward slash to create a table containing counts and percentages.

The NOPROCTITLE option can be placed in the PROC FREQ statement to remove the procedure title The FREQ Procedure.

=================================================

 

6.
Question 6
Which PROC FREQ step creates the results shown here?

1 point

123
proc freq data=sashelp.shoes / levels;
tables Region nocum;
run;

123
proc freq data=sashelp.shoes nlevels;
tables Region / nocum;
run;

123
proc freq data=sashelp.shoes;
tables Region nocum;
run;

123
proc freq data=sashelp.shoes levels;
tables Region / nocum;
run;

=================================================

 

7.
Question 7
Which report is created from the following PROC FREQ step?

1234
proc freq data=sashelp.cars;
where Cylinders in (4,6) and Type in (‘Sedan’,’SUV’);
tables Type*Cylinders / nocol norow crosslist;
run;
1 point

=================================================

 

8.
Question 8
Which statement is true concerning the MEANS procedure?

1 point

The MAXDEC= option is used in the VAR statement to specify the number of decimal places for the statistics.

The VAR statement is required and identifies the analysis columns.

The WAYS statement specifies the number of ways to make unique combinations of class columns.

The _COUNT_ and _FREQ_ columns are automatically included in the output summary table that is produced by the OUT= option of the OUTPUT statement.

=================================================

 

9.
Question 9
An input table must be pre-sorted by the column(s) listed in the CLASS statement of a PROC MEANS step.

1234
proc means data=sashelp.heart;
var Cholesterol;
class Weight_Status;
run;
1 point

True

False

=================================================

 

10.
Question 10
Which statement from PROC MEANS contains valid syntax for creating a summary output table?

1 point

out=work.summary mean;

output out=work.summary mean(Weight)=TotW;

output out work.summary Weight=TotW;

out work.summary mean(Weight)=TotW;

 

 

Week- 6

Exporting Results

1.
Question 1
Which statement is false concerning the options for the PROC EXPORT statement?

1 point

The DATA= option identifies the input SAS table.

The REPLACE option specifies to overwrite an existing file.

The OUT= option specifies the path and file name of the external data file being created.

The DBMS= option specifies the database identifier for the type of file being created.

=================================================

 

2.
Question 2
Which PROC EXPORT step contains valid syntax?

1 point

12
proc export outfile=”c:\temp\cars.txt” tab
data=sashelp.cars replace; run;

12
proc export data=sashelp.cars dbms=csv
outfile=”c:\temp\cars.csv”; run;

12
proc export dbms=tab data=sashelp.cars replace=yes
outfile=”c:\temp\cars.txt”; run;

12
proc export data=sashelp.class; dbms=csv;
outfile=”c:\temp\cars.csv”; run;

=================================================

 

3.
Question 3
What does the following program create?

12345678
libname sales xlsx ‘c:\mydata\midyear.xlsx’;

data sales.q1_2018;
set sasdata.qtr1_2018;
run;
data sales.q2_2018;
set sasdata.qtr2_2018;
run;
1 point

two worksheets in the Excel workbook: midyear: q1_2018 and q2_2018

two worksheets in the Excel workbook: sales: q1_2018 and q2_2018

two SAS tables: sales.q1_2018 and sales.q2_2018

two Excel workbooks: sales.q1_2018 and sales.q2_2018

=================================================

 

4.
Question 4
Which statement disassociates the sales libref?

libname sales xlsx ‘c:\mydata\midyear.xlsx’;

1 point

libname sales end;

libname sales close;

libname sales disassociate;

libname sales clear;

=================================================

 

5.
Question 5
What type of output file does this program create?

12345
libname mylib xlsx “s:/workshop/output/test.xlsx”;

data class_list;
set sashelp.class;
run;
1 point

SAS table

delimited file

Microsoft Excel XLS file

Microsoft Excel XLSX file

=================================================

 

6.
Question 6
Which of these programs creates a Microsoft Excel file?

1 point

1234
ods excel file=”s:/workshop/output/class.xlsx”;
proc print data=sashelp.class;
run;
ods excel close;

1234
libname mylib xlsx “s:/workshop/output/class.xlsx”;
data mylib.class_list;
set sashelp.class;
run;

both

neither

=================================================

 

7.
Question 7
Which of the following is not a valid ODS statement?

1 point

ods csvall file=’c:\temp\myfile.csv’;

ods powerpoint file=’c:\temp\myfile.ppt’;

ods word file=’c:\temp\myfile.doc’;

ods pdf file=’c:\temp\myfile.pdf’;

=================================================

 

8.
Question 8
Which statement needs to be added to the end of this program?

1234
ods pdf file=’c:\temp\myfile.pdf’;

proc print data=sashelp.class;
run;
1 point

ods clear;

ods pdf clear;

ods pdf close;

ods close;

=================================================

 

9.
Question 9
Which statement is false concerning the options for the ODS statement?

1 point

The FILE= option specifies the output file to create.

The STARTPAGE= option controls the behavior of page breaks.

The STYLE= option names the desired font.

The PDFTOC= option controls the level of the expansion of the table of contents in PDF documents.

=================================================

 

10.
Question 10
Which statement contains valid syntax for specifying a worksheet name?

1 point

ods excel sheet_name=’Males’;

ods excel (sheet_name=’Males’);

ods excel option(sheet_name=’Males’);

ods excel options(sheet_name=’Males’);

 

 

Using SQL in SAS

1.
Question 1
What is the correct order of the following four clauses?

1 point

4123
order by …
from …
select …
where …

1234
select …
from …
where …
order by …

1234
from …
select …
where …
order by …

1234
select …
where …
order by …
from …

=================================================

 

2.
Question 2
Which of the following is false regarding the SQL procedure?

1 point

Formats can be specified in the FROM clause.

The SELECT and FROM clauses are required in the SELECT statement.

The procedure ends with a QUIT statement.

Column names are separated with commas.

=================================================

 

3.
Question 3
Which syntax is valid for creating a computed column in the SELECT clause?

1 point

Ratio = Height/Weight

Height/Weight = Ratio

Ratio as Height/Weight

Height/Weight as Ratio

=================================================

 

4.
Question 4
The SELECT statement creates a report. Which clause can be added before the SELECT clause to create a table?

1 point

create table=work.new as

create work.new table

create work.new =

create table work.new as

=================================================

 

5.
Question 5
Which SELECT statement produces the given output?

Name Height
Thomas 57.5
Joyce 51.3
1 point

1234
select Name, Height
from sashelp.class
where age=12
order by desc Height;

1234
select Name Height
from sashelp.class
where age=12
order by Height;

1234
select Name Height
from sashelp.class
where age=12
order by desc Height;

1234
select Name, Height
from sashelp.class
where age=12
order by Height desc;

=================================================

 

6.
Question 6
Which SQL statement can delete tables?

1 point

DELETE

DROP

SELECT

VOID

=================================================

 

7.
Question 7
If an inner join is performed on the following tables based on the ID and IDNO columns, how many rows will be in the PROC SQL report?

1 point

three

four

one

two

=================================================

 

8.
Question 8
Which statement has the correct syntax for performing an inner join?

1 point

123
select ID, Name, Salary
from one join two
on ID=IDNO;

123
select ID, Name, Salary
from one inner join two
on ID=IDNO;

123
select ID, Name, Salary
from one join two
where ID=IDNO;

123
select ID, Name, Salary
from one inner join two
where ID=IDNO;

=================================================

 

9.
Question 9
Which ON clause has valid qualifying syntax?

1 point

12
from empsau inner join phonec
on e.empid=p.empid;

12
from empsau inner join phonec
on first.empid=second.empid;

12
from empsau inner join phonec
on left.empid=right.empid;

123
from empsau inner join phonec
on empsau.empid=phonec.empid;

=================================================

 

10.
Question 10
Which FROM clause properly creates aliases?

1 point

from empsau(e) inner join phonec(p)

from empsau as e inner join phonec as p

from empsau of e inner join phonec of p

from empsau=e inner join phonec=p

 

 

 

Other Questions Of This Category