1.5 Flashcards

1
Q

Which of the following is false regarding the TITLE statement?

a) TITLE is a global statement that establishes a title for all reports created in your SAS session
b) The syntax is TITLE “title-text”;
c) You can have unlimited title lines.
d) You specify a number after the keyword TITLE to indicate the line number of the title.
e) TITLE and TITLE1 are equivalent.

A

c) You cannot have unlimited TITLE lines. You can have up to 10 lines of titles.

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

Which syntax below will clear a predefined TITLE statement?

a) TITLE clear;
b) TITLE “New Title”;
c) TITLE
d) TITLE;

A

d)TITLE;

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

Which of the following will turn off the default titles in SAS procedures?

a) ODS NOPROCTITLE;
b) ODS NOTITLE;
c) NOPROCTITLE;
d) noproctitle option in the PROC step

A

a) ODS NOPROCTITLE;

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

True/False - The following code will run without error, filter the proc report by age and indicate the age filter in the title.

%let age = 13;

title “Class Report”;
title2 “Age=&age”;

proc print data=pg1.class_birthdate;
where age=&age;
run;

title;

A

True - when referencing a macro variable in a title, you must enclose the macro variable in double quotation marks so that SAS replaces the macro variable with the stored text.

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

Which of the following PROC steps will show the specified column labels on the report?

proc means data=sashelp.cars;
where type=”Sedan”;
var MSRP MPG_Highway;
label MSRP=”Manufacturer Suggested Retail Price”
MPG_Highway=”Highway Miles per Gallon”;
run;

proc print data=sashelp.cars;
where type=”Sedan”;
var MSRP MPG_Highway;
label MSRP=”Manufacturer Suggested Retail Price”
MPG_Highway=”Highway Miles per Gallon”;
run;

a) Both the PROC MEANS and PROC PRINT reports will include the column labels.
b) Only the PROC MEANS report will include the column labels
c) Only the PROC PRINT report will include the column labels
d) Neither of the PROC steps will generate reports with column labels

A

b) Only the PROC MEANS step.

The PROC MEANS, PROC FREQ, and most other procedures automatically display the labels in the results, but PROC PRINT is an exception. Because the main purpose of PROC PRINT is to examine the data, column names are displayed by default. To display labels instead, you must add the LABEL option in the PROC PRINT statement.

proc print data=sashelp.cars label;
where type=”Sedan”;
var MSRP MPG_Highway;
label MSRP=”Manufacturer Suggested Retail Price”
MPG_Highway=”Highway Miles per Gallon”;
run;

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

Which statement can be used to segment a report based on the unique values of one or more columns?

a) WHERE
b) GROUP
c) BY
d) IN

A

c) BY - You can use the BY statement in a reporting procedure to segment a report based on the unique values of one or more columns. To do this, you must sort the data first using the same BY-column.

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

Which of the statements below is true?

a) Adding a label statement to either a PROC or DATA step will permanently create the label.
b) Adding a label statement to a DATA step permanently creates a label, while adding a label to the PROC step creates only a temporary label.
c) Adding a label statement to a PROC step permanently creates a label, while adding a label to the DATA step creates only a temporary label.
d) Labels are always temporary and must be re-specified in each step.

A

b) Adding a label statement to a DATA step permanently creates a label, while adding a label to the PROC step creates only a temporary label.

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

Which statement will generate a table showing the number of distinct values in the PROC FREQ step below?

proc freq data=pg1.storm_final;
tables BasinName Season;
run;

a) FREQ
b) LEVELS
c) NLEVELS
d) None of the above

A

c) NLEVELS - The NLEVELS option added an NLEVELS table at the top of the report. It indicates that for the column BasinName, there were six unique values, and for Season, there were 38.

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

Which of the following will generate a report that sorts unique values of each column by descending frequency?

a) proc freq data = mydata order=freq;
        tables BasinName Season;
    run;
b) proc freq data = mydata descending;
        tables BasinName Season;
    run;
c) proc sort data = mydata;
         by descending BasinName descending Season;
   run;
A

a) proc freq data = mydata order=freq;
tables BasinName Season;
run;

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

True/False - When you place an asterisk between two columns in the TABLES statement, PROC FREQ produces a two-way frequency, or cross-tabulation report.

A

True

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

Which of the following statements will remove the row and column percentages from the report and just include frequency counts?

a) tables BasinNameStartDate / norow nocol nopercent;
b) tables BasinName
StartDate / norow nocol nocum;
c) tables BasinNameStartDate / nopercent;
d) tables BasinName
StartDate / norow nocol nopercent nocum;

A

a) tables BasinName*StartDate / norow nocol nopercent;

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

What does the CROSSLIST option do in the PROC FREQ step?

a) Displays row and column scores
b) Includes all possible combinations of variable levels in an output table
c) Displays crosstabulation tables in ODS column format
d) Displays two-way to n-way tables in a list format

A

c) Displays crosstabulation tables in ODS column format

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

What does LIST option do in the PROC FREQ step?

a) Displays row and column scores
b) Includes all possible combinations of variable levels in an output table
c) Displays crosstabulation tables in ODS column format
d) Displays two-way to n-way tables in a list format

A

d) Displays two-way to n-way tables in a list format

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

Which statement do you use to group data in a PROC MEANS procedure?

a) GROUP
b) BY
c) TABLES
d) CLASS

A

d) The CLASS statement enables you to name one of more columns to group the data. And then statistics are calculated for each unique value of the CLASS columns. When you have more than one CLASS column, you can use the WAYS statement to control the combination of values of the Class columns.

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

True/False - The following procedure will generate only the mean and median values of the MaxWindMPH variable.

proc means data=pg1.storm_final;
var MaxWindMPH / mean median;
run;

A

False - The correct syntax is:

proc means data=pg1.storm_final mean median;
var MaxWindMPH;
run;

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

True/False - The following procedure will generate an output table that summarizes the data in sashelp.heart.

proc means data=sashelp.heart noprint;
   var Cholesterol Weight;
   class Chol_Status Smokings_Status;
   output out=heart_stats mean=AvgWeight;
run;
A

True - You can use the OUTPUT statement in PROC MEANS to create a summary data set. The OUT= option names the output table. In the OUTPUT statement you can generate output statistics and name a column to store them in.

17
Q

What is the maximum number of characters that can be used with the LABEL statement to provide more descriptive column headers?

a) 32
b) 36
c) 256
d) unlimited

A

c) 256

18
Q

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

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;

a) The Top Line
b) The Top Line
The Next Line
c) The Top Line
The Second Line
d) The Top Line
The First Line
The Next Line

A

a) The Top Line

TITLE is the same as TITLE1. The TITLE statement for the last PROC PRINT step cancels all the higher TITLEn statements.

19
Q

Which statement is true based on the given program?

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

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

proc means data=baseball2;
   var BatAvg;
   class Team;
run;

a) The column BatAvg will have a permanent label in the sashelp.baseball data set.
b) The label for BatAvg will appear in the PROC PRINT report.
c) The label for BatAvg will appear in the PROC MEANS report.
d) The label for BatAvg will appear in both reports.

A

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

The label will appear in the PROC MEANS report. The label will not appear in the PROC PRINT report because the LABEL option is missing in the PROC PRINT statement. The output table work.baseball2 (not the input table sashelp.baseball) contains a permanent label for BatAvg.)

20
Q

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

a) The BY statement is responsible for sorting the table.
b) Only one column can be specified in the BY statement.
c) The BY statement groups the report by the specified columns.
d) The BY statement must be the first statement after the PROC statement.

A

c) The BY statement groups the report by the specified columns.

21
Q

Which statement is false concerning the FREQ procedure?

a) The NOPROCTITLE option can be placed in the PROC FREQ statement to remove the procedure title The FREQ Procedure.
b) The ORDER=FREQ option can be placed in the PROC FREQ statement to display the column values in descending frequency count order.
c) The PLOTS= option can be placed in the TABLES statement after the forward slash to create bar charts based on counts or percentages.
d) The OUT= option can be placed in the TABLES statement after the forward slash to create a table containing counts and percentages.

A

a) The NOPROCTITLE option goes in a global ODS statement to remove the procedure titles.

22
Q
Which of the following PROC FREQ steps will generate two tables, one titled "Number of Variable Levels"?
a) proc freq data=sashelp.shoes;
         tables Region nocum;
    run;
b) proc freq data=sashelp.shoes levels;
         tables Region / nocum;
    run;
c) proc freq data=sashelp.shoes nlevels;
         tables Region / nocum;
   run;
d) proc freq data=sashelp.shoes;
         tables Region / nocum nlevels;
    run;
A

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

The NLEVELS option in the PROC MEANS statement creates a table displaying the number of levels fora ll TABLES columns. The NOCUM option in the TABLES statement, which goes after the forward slash, suppresses the display of cumulative frequencies and cumulative percentages.

23
Q

True/False - The following table is generated based on the PROC FREQ procedure below.

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

                                                    Cumulative Cumulative Type Cylinder Frequency Percent Frequency Percent SUV            4                  7       2.77               7              2.77 SUV            6               30       11.86             37            14.62
A

False - The table displayed will look like this:

Table of Type by Cylinders
Type Cylinders Frequency Percent
SUV 4 7 2.77
6 30 11.86
Total 37 14.62

24
Q

Which statement is true concerning the MEANS procedure?

a) The VAR statement is required and identifies the analysis columns.
b) The WAYS statement specifies the number of ways to make unique combinations of class columns.
c) The MAXDEC= option is used in the VAR statement to specify the number of decimal places for the statistics.
d) The COUNT and FREQ columns are automatically included in the output summary table that is produced by the OUT= option of the OUTPUT statement.

A

b) The WAYS statement specifies the number of ways to make unique combinations of class variables. The VAR statement is not required. The MAXDEC= option goes in the PROC MEANS statement. FREQ and TYPE are automatically included in the output summary table.

25
Q

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

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

a) True;
b) False;

A

b) False - The input table does not have to be pre-sorted by the column(s) in the CLASS statement of the PROC MEANS step. If a BY statement is used instead of a CLASS statement, the columns need to be sorted.

26
Q

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

a) out=work.summary mean;
b) out work.summary mean(Weight)=TotW;
c) output out work.summary Weight=TotW;
d) output out=work.summary mean(Weight)=TotW;

A

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