• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/58

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

58 Cards in this Set

  • Front
  • Back
The following SAS program is submitted:

data work.pieces;
do while (n lt 6);
n + 1;
end;
run;


Which one of the following is the value of the variable N in the output data set?
A. 4
B. 5
C. 6
D. 7
Answer : C
When n=6 the do while stops
The following SAS program is submitted:

data work.pieces;
do while (n lt 6);
n + 1;
end;
run;


Which one of the following is the value of the variable N in the output data set?
A. 4
B. 5
C. 6
D. 7
Answer : C
When n=6 the do while stops
The following SAS program is submitted:


data work.clients;
calls = 6;
do while (calls le 6);
calls + 1;
end;
run;


Which one of the following is the value of the variable CALLS in the output data set?
A. 4
B. 5
C. 6
D. 7
Answer D.
Calls advances to 7 then stops in the do while loop
The following SAS program is submitted:


data work.clients;
calls = 6;
do while (calls le 6);
calls + 1;
end;
run;


Which one of the following is the value of the variable CALLS in the output data set?
A. 4
B. 5
C. 6
D. 7
Answer D.
Calls advances to 7 then stops in the do while loop
The SAS data set BANKS is listed below:


name rate

FirstCapital 0.0718
DirectBank 0.0721
VirtualDirect 0.0728


The following SAS program is submitted:


data newbank;
do year = 1 to 3;
set banks;
capital + 5000;
end;
run;


Which one of the following represents how many observations and variables will exist in the SAS data set NEWBANK?
A. 0 observations and 0 variables
B. 1 observations and 4 variables
C. 3 observations and 3 variables
D. 9 observations and 2 variables
Answer: B

The input dataset Banks has 3 obs that are read in the do loop…Since there is no explicit OUTPUT statement the output dsn NEWBANK will have 1 observation 4 variables
Name rate year capital.
The SAS data set BANKS is listed below:


name rate

FirstCapital 0.0718
DirectBank 0.0721
VirtualDirect 0.0728


The following SAS program is submitted:


data newbank;
do year = 1 to 3;
set banks;
capital + 5000;
end;
run;


Which one of the following represents how many observations and variables will exist in the SAS data set NEWBANK?
A. 0 observations and 0 variables
B. 1 observations and 4 variables
C. 3 observations and 3 variables
D. 9 observations and 2 variables
Answer: B

The input dataset Banks has 3 obs that are read in the do loop…Since there is no explicit OUTPUT statement the output dsn NEWBANK will have 1 observation 4 variables
Name rate year capital.
The SAS data set SASUSER.HOUSES contains a variable PRICE which has been assigned a permanent label of "Asking Price".


Which one of the following SAS programs temporarily replaces the label "Asking Price" with the label "Sale Price" in the output?


A. proc print data = sasuser.houses;
label price = "Sale Price";
run;


B. proc print data = sasuser.houses label;
label price "Sale Price";
run;


C. proc print data = sasuser.houses label;
label price = "Sale Price";
run;


D. proc print data = sasuser.houses label = "Sale Price";
run;
Answer C
The SAS data set SASUSER.HOUSES contains a variable PRICE which has been assigned a permanent label of "Asking Price".


Which one of the following SAS programs temporarily replaces the label "Asking Price" with the label "Sale Price" in the output?


A. proc print data = sasuser.houses;
label price = "Sale Price";
run;


B. proc print data = sasuser.houses label;
label price "Sale Price";
run;


C. proc print data = sasuser.houses label;
label price = "Sale Price";
run;


D. proc print data = sasuser.houses label = "Sale Price";
run;
Answer C
SAS Certification Questions
Collection of Practice questions and Answers for SAS Certification...


CLICK ON THE COMMENTS TO VIEW THE ANSWERS
Sunday, January 24, 2010

Base 29
The value 110700 is stored in a numeric variable.

Which one of the following SAS formats is used to display the value as $110,700.00 in a report?

A. comma8.2
B. comma11.2
C. dollar8.2
D. dollar11.2
Answer D
SAS Certification Questions
Collection of Practice questions and Answers for SAS Certification...


CLICK ON THE COMMENTS TO VIEW THE ANSWERS
Sunday, January 24, 2010

Base 29
The value 110700 is stored in a numeric variable.

Which one of the following SAS formats is used to display the value as $110,700.00 in a report?

A. comma8.2
B. comma11.2
C. dollar8.2
D. dollar11.2
Answer D
A realtor has two customers. One customer wants to view a list of homes selling for less than $60,000. The other customer wants to view a list of homes selling for greater than $100,000. Assuming the PRICE variable is numeric, which one of the following PRINT procedure steps will select all desired observations?

A. proc print data = sasuser.houses;
where price lt 60000;
where price gt 100000;
run;

B. proc print data = sasuser.houses;
where price lt 60000 or price gt 100000;
run;

C. proc print data = sasuser.houses;
where price lt 60000 and price gt 100000;
run;

D. proc print data = sasuser.houses;
where price lt 60000 or where price gt 100000;
run;
Answer: B
A realtor has two customers. One customer wants to view a list of homes selling for less than $60,000. The other customer wants to view a list of homes selling for greater than $100,000. Assuming the PRICE variable is numeric, which one of the following PRINT procedure steps will select all desired observations?

A. proc print data = sasuser.houses;
where price lt 60000;
where price gt 100000;
run;

B. proc print data = sasuser.houses;
where price lt 60000 or price gt 100000;
run;

C. proc print data = sasuser.houses;
where price lt 60000 and price gt 100000;
run;

D. proc print data = sasuser.houses;
where price lt 60000 or where price gt 100000;
run;
Answer: B
The following SAS program is submitted:


proc sort data = sasuser.houses out = houses;
by style;
run;
proc print data = houses;
.
run;


style bedrooms baths price
CONDO 2 1.5 80050
3 2.5 79350
4 2.5 127150
2 2.0 110700
RANCH 2 1.0 64000
3 3.0 86650
3 1.0 89100
1 1.0 34550
SPLIT 1 1.0 65850
4 3.0 94450
3 1.5 73650
TWOSTORY 4 3.0 107250
2 1.0 55850
2 1.0 69250
4 2.5 102950


Which of the following SAS statement(s) create(s) the report?
A. id style;
B. id style; var style bedrooms baths price;
C. id style; by style; var bedrooms baths price;
D. id style; by style; var style bedrooms baths price;
Answer : C
The following SAS program is submitted:


proc sort data = sasuser.houses out = houses;
by style;
run;
proc print data = houses;
.
run;


style bedrooms baths price
CONDO 2 1.5 80050
3 2.5 79350
4 2.5 127150
2 2.0 110700
RANCH 2 1.0 64000
3 3.0 86650
3 1.0 89100
1 1.0 34550
SPLIT 1 1.0 65850
4 3.0 94450
3 1.5 73650
TWOSTORY 4 3.0 107250
2 1.0 55850
2 1.0 69250
4 2.5 102950


Which of the following SAS statement(s) create(s) the report?
A. id style;
B. id style; var style bedrooms baths price;
C. id style; by style; var bedrooms baths price;
D. id style; by style; var style bedrooms baths price;
Answer : C
Unless specified, which variables and data values are used to calculate statistics in the MEANS procedure?


A. non-missing numeric variable values only
B. missing numeric variable values and non-missing numeric variable values only
C. non-missing character variables and non-missing numeric variable values only
D. missing character variables, non-missing character variables, missing numeric variable values, and non-missing numeric variable
values
Answer A
Unless specified, which variables and data values are used to calculate statistics in the MEANS procedure?


A. non-missing numeric variable values only
B. missing numeric variable values and non-missing numeric variable values only
C. non-missing character variables and non-missing numeric variable values only
D. missing character variables, non-missing character variables, missing numeric variable values, and non-missing numeric variable
values
Answer A
The following SAS program is submitted:


proc means data = sasuser.houses std mean max;
var sqfeet;
run;


Which one of the following is needed to display the standard deviation with only two decimal places?
A. Add the option MAXDEC = 2 to the MEANS procedure statement.
B. Add the statement MAXDEC = 7.2; in the MEANS procedure step.
C. Add the statement FORMAT STD 7.2; in the MEANS procedure step.
D. Add the option FORMAT = 7.2 option to the MEANS procedure statement.
Answer A
Option Maxdec=2 is sufficient
The following SAS program is submitted:


proc means data = sasuser.houses std mean max;
var sqfeet;
run;


Which one of the following is needed to display the standard deviation with only two decimal places?
A. Add the option MAXDEC = 2 to the MEANS procedure statement.
B. Add the statement MAXDEC = 7.2; in the MEANS procedure step.
C. Add the statement FORMAT STD 7.2; in the MEANS procedure step.
D. Add the option FORMAT = 7.2 option to the MEANS procedure statement.
Answer A
Option Maxdec=2 is sufficient
The following SAS program is submitted:


footnote1 'Sales Report for Last Month';
footnote2 'Selected Products Only';
footnote3 'All Regions';
footnote4 'All Figures in Thousands of Dollars';


proc print data = sasuser.shoes;
footnote2 'All Products';
run;


Which one of the following contains the footnote text that is displayed in the report?

A. All Products
B. Sales Report for Last Month All Products
C. All Products All Regions All Figures in Thousands of Dollars
D. Sales Report for Last Month All Products All Regions All Figures in Thousands of Dollars
Answer B

Sales Report for Last Month All Products Only

Since footnote2 has a higher precedence footnote 3 and 4 get cancelled.
The following SAS program is submitted:


footnote1 'Sales Report for Last Month';
footnote2 'Selected Products Only';
footnote3 'All Regions';
footnote4 'All Figures in Thousands of Dollars';


proc print data = sasuser.shoes;
footnote2 'All Products';
run;


Which one of the following contains the footnote text that is displayed in the report?

A. All Products
B. Sales Report for Last Month All Products
C. All Products All Regions All Figures in Thousands of Dollars
D. Sales Report for Last Month All Products All Regions All Figures in Thousands of Dollars
Answer B

Sales Report for Last Month All Products Only

Since footnote2 has a higher precedence footnote 3 and 4 get cancelled.
Which one of the following SAS system options prevents the page number from appearing on a report?


A. NONUM
B. NOPAGE
C. NONUMBER
D. NOPAGENUM
Answer C
Options nonumber;
Which one of the following SAS system options prevents the page number from appearing on a report?


A. NONUM
B. NOPAGE
C. NONUMBER
D. NOPAGENUM
Answer C
Options nonumber;
Which one of the following SAS system options displays the time on a report?


A. TIME
B. DATE
C. TODAY
D. DATETIME
Answer: B

Options date; displays the time and date
Which one of the following SAS system options displays the time on a report?


A. TIME
B. DATE
C. TODAY
D. DATETIME
Answer: B

Options date; displays the time and date
The following SAS program is submitted:


options pageno = 1;


proc print data = sasuser.houses;
run;


proc means data = sasuser.shoes;
run;


The report created by the PRINT procedure step generates 5 pages of output.


What is the page number on the first page of the report generated by the MEANS procedure step?
A. 1
B. 2
C. 5
D. 6
Answer: D

Proc Print prints for 5 pages...Means starts from 6
The following SAS program is submitted:


options pageno = 1;


proc print data = sasuser.houses;
run;


proc means data = sasuser.shoes;
run;


The report created by the PRINT procedure step generates 5 pages of output.


What is the page number on the first page of the report generated by the MEANS procedure step?
A. 1
B. 2
C. 5
D. 6
Answer: D

Proc Print prints for 5 pages...Means starts from 6
The following SAS program is submitted:


proc format;
value score
1 - 50 = 'Fail'
51 - 100 = 'Pass';
run;


proc report data = work.courses nowd;
column exam;
define exam / display format = score.;
run;


The variable EXAM has a value of 50.5.


How will the EXAM variable value be displayed in the REPORT procedure output?
A. Fail
B. Pass
C. 50.5
D. . (missing numeric value)
Answer: C

Values from 50 to 51 are not covered in the proc format range.
The following SAS program is submitted:


proc format;
value score
1 - 50 = 'Fail'
51 - 100 = 'Pass';
run;


proc report data = work.courses nowd;
column exam;
define exam / display format = score.;
run;


The variable EXAM has a value of 50.5.


How will the EXAM variable value be displayed in the REPORT procedure output?
A. Fail
B. Pass
C. 50.5
D. . (missing numeric value)
Answer: C

Values from 50 to 51 are not covered in the proc format range.
The following SAS program is submitted:

proc means data = sasuser.shoes;
where product in ('Sandal' , 'Slipper' , 'Boot');
run;


Which one of the following ODS statements completes the program and sends the report to an HTML file?
A. ods html = 'sales.html';
B. ods file = 'sales.html';
C. ods file html = 'sales.html';
D. ods html file = 'sales.html';
Answer: D
ods html file = 'sales.html';
The following SAS program is submitted:

proc means data = sasuser.shoes;
where product in ('Sandal' , 'Slipper' , 'Boot');
run;


Which one of the following ODS statements completes the program and sends the report to an HTML file?
A. ods html = 'sales.html';
B. ods file = 'sales.html';
C. ods file html = 'sales.html';
D. ods html file = 'sales.html';
Answer: D
ods html file = 'sales.html';
Which one of the following ODS statement options terminates output being written to an HTML file?


A. END
B. QUIT
C. STOP
D. CLOSE
Answer : D

ods html close; tells SAS to terminate output being written to an HTML file
Which one of the following ODS statement options terminates output being written to an HTML file?


A. END
B. QUIT
C. STOP
D. CLOSE
Answer : D

ods html close; tells SAS to terminate output being written to an HTML file
The following SAS program is submitted:


libname sasdata 'SAS-data-library';
data test;
set sasdata.chemists;
if jobcode = 'chem3' then description = 'Senior Chemist';
else description = 'Unknown';
run;


A value for the variable JOBCODE is listed below:
JOBCODE
CHEM3


Which one of the following values does the variable DESCRIPTION contain?


A. chem3
B. Unknown
C. Senior Chemist
D. ' ' (missing character value)
Answer: B

The dataset has ‘CHEM3’ and the if statement is looking for ‘chem3’…
Remember the SAS variables are not case-sensitive but the SAS DATA is…
The following SAS program is submitted:


libname sasdata 'SAS-data-library';
data test;
set sasdata.chemists;
if jobcode = 'chem3' then description = 'Senior Chemist';
else description = 'Unknown';
run;


A value for the variable JOBCODE is listed below:
JOBCODE
CHEM3


Which one of the following values does the variable DESCRIPTION contain?


A. chem3
B. Unknown
C. Senior Chemist
D. ' ' (missing character value)
Answer: B

The dataset has ‘CHEM3’ and the if statement is looking for ‘chem3’…
Remember the SAS variables are not case-sensitive but the SAS DATA is…
The following SAS program is submitted:


libname sasdata 'SAS-data-library';
data test;
set sasdata.chemists;
if jobcode = 'Chem2' then description = 'Senior Chemist';
else description = 'Unknown';
run;


A value for the variable JOBCODE is listed below:
JOBCODE
chem2

Which one of the following values does the variable DESCRIPTION contain?
A. Chem2
B. Unknown
C. Senior Chemist
D. ' ' (missing character value)
Answer: B

The dataset has ‘chem2’ and the if statement is looking for ‘Chem2’…
Remember the SAS variables are not case-sensitive but the SAS DATA is…
The following SAS program is submitted:


libname sasdata 'SAS-data-library';
data test;
set sasdata.chemists;
if jobcode = 'Chem2' then description = 'Senior Chemist';
else description = 'Unknown';
run;


A value for the variable JOBCODE is listed below:
JOBCODE
chem2

Which one of the following values does the variable DESCRIPTION contain?
A. Chem2
B. Unknown
C. Senior Chemist
D. ' ' (missing character value)
Answer: B

The dataset has ‘chem2’ and the if statement is looking for ‘Chem2’…
Remember the SAS variables are not case-sensitive but the SAS DATA is…
The contents of the raw data file EMPLOYEE are listed below:


--------10-------20-------30
Ruth 39 11 (39 starts at col-7 and 11 at col-10)
Jose 32 22
Sue 30 33
John 40 44



The following SAS program is submitted:


data test;
infile 'employee';
input employee_name $ 1-4;
if employee_name = 'Sue' then input age 7-8;
else input idnum 10-11;
run;


Which one of the following values does the variable AGE contain when the name of the employee is "Sue"?
A. 30
B. 33
C. 40
D. . (missing numeric value)
C
The program accepts the name first and the performs the if operation. Since you are not having the @ sign to hold on to the record till for the if condition to be tested, the next input record is read the value of idnum is written as 22 for Ruth and the value of age for Sue is 40. Add the @ sign to hold the record at the input statement.
The contents of the raw data file EMPLOYEE are listed below:


--------10-------20-------30
Ruth 39 11 (39 starts at col-7 and 11 at col-10)
Jose 32 22
Sue 30 33
John 40 44



The following SAS program is submitted:


data test;
infile 'employee';
input employee_name $ 1-4;
if employee_name = 'Sue' then input age 7-8;
else input idnum 10-11;
run;


Which one of the following values does the variable AGE contain when the name of the employee is "Sue"?
A. 30
B. 33
C. 40
D. . (missing numeric value)
C
The program accepts the name first and the performs the if operation. Since you are not having the @ sign to hold on to the record till for the if condition to be tested, the next input record is read the value of idnum is written as 22 for Ruth and the value of age for Sue is 40. Add the @ sign to hold the record at the input statement.
The SAS data set EMPLOYEE_INFO is listed below:

IDNumber Expenses
2542 100.00
3612 133.15
2198 234.34
2198 111.12

The following SAS program is submitted:

proc sort data = employee_info;
run;

Which one of the following BY statements completes the program and sorts the data sequentially by ascending expense values within each ascending IDNUMBER value?

A. by Expenses IDNumber;
B. by IDNumber Expenses;
C. by ascending (IDNumber Expenses);
D. by ascending IDNumber ascending Expenses;
Answer is B.

"by ascending EXPENSES values within each ascending IDNUMBER value" means sorting IDNUMBER first.
The SAS data set EMPLOYEE_INFO is listed below:

IDNumber Expenses
2542 100.00
3612 133.15
2198 234.34
2198 111.12

The following SAS program is submitted:

proc sort data = employee_info;
run;

Which one of the following BY statements completes the program and sorts the data sequentially by ascending expense values within each ascending IDNUMBER value?

A. by Expenses IDNumber;
B. by IDNumber Expenses;
C. by ascending (IDNumber Expenses);
D. by ascending IDNumber ascending Expenses;
Answer is B.

"by ascending EXPENSES values within each ascending IDNUMBER value" means sorting IDNUMBER first.
A SAS PRINT procedure output of the WORK.LEVELS data set is listed below:


Obs name level
------------------------
1 Frank 1
2 Joan 2
3 Sui 2
4 Jose 3
5 Burt 4
6 Kelly .
7 Juan 1


The following SAS program is submitted:

data work.expertise;
set work.levels;
if level = . then expertise = 'Unknown';
else if level = 1 then expertise = 'Low';
else if level = 2 or 3 then expertise = 'Medium';
else expertise = 'High';
run;


Which of the following values does the variable EXPERTISE contain?
A. Low, Medium, and High only
B. Low, Medium, and Unknown only
C. Low, Medium, High, and Unknown only
D. Low, Medium, High, Unknown, and ' ' (missing character
Answer B
This is a tricky question..

Notice this statement.

else if level = 2 or 3 then expertise = 'Medium';
it should have been level in (2,3) or level=2 or level=3.

surprisingly SAS does not throw an error….
It tries to evaluate the expression “level = 2 or 3”… It’s weird but I went ahead and tried the code…Look at the values of the Condition and Level in the Log below
A SAS PRINT procedure output of the WORK.LEVELS data set is listed below:


Obs name level
------------------------
1 Frank 1
2 Joan 2
3 Sui 2
4 Jose 3
5 Burt 4
6 Kelly .
7 Juan 1


The following SAS program is submitted:

data work.expertise;
set work.levels;
if level = . then expertise = 'Unknown';
else if level = 1 then expertise = 'Low';
else if level = 2 or 3 then expertise = 'Medium';
else expertise = 'High';
run;


Which of the following values does the variable EXPERTISE contain?
A. Low, Medium, and High only
B. Low, Medium, and Unknown only
C. Low, Medium, High, and Unknown only
D. Low, Medium, High, Unknown, and ' ' (missing character
Answer B
This is a tricky question..

Notice this statement.

else if level = 2 or 3 then expertise = 'Medium';
it should have been level in (2,3) or level=2 or level=3.

surprisingly SAS does not throw an error….
It tries to evaluate the expression “level = 2 or 3”… It’s weird but I went ahead and tried the code…Look at the values of the Condition and Level in the Log below
The contents of the raw data file SIZE are listed below:


--------10-------20-------30
72 95


The following SAS program is submitted:


data test;
infile 'size';
input @1 height 2. @4 weight 2;
run;


Which one of the following is the value of the variable WEIGHT in the output data set?
A. 2
B. 72
C. 95
D. . (missing numeric value)
Answer: A

The start column for weight has been mentioned as 2… So SAS reads in 2 in the value of 72

Execute this and c for yourself…the answers are 2,0,1 for each observations..
The contents of the raw data file SIZE are listed below:


--------10-------20-------30
72 95


The following SAS program is submitted:


data test;
infile 'size';
input @1 height 2. @4 weight 2;
run;


Which one of the following is the value of the variable WEIGHT in the output data set?
A. 2
B. 72
C. 95
D. . (missing numeric value)
Answer: A

The start column for weight has been mentioned as 2… So SAS reads in 2 in the value of 72

Execute this and c for yourself…the answers are 2,0,1 for each observations..
The following SAS program is submitted:

data work.test;
array agents{4} $ 12 sales1 - sales4;
run;

Which one of the following represents the variables that are contained in the output data set?

A. SALES1, SALES2, SALES3, SALES4
B. AGENTS1, AGENTS2, AGENTS3, AGENTS4
C. None, the DATA step fails because the ARRAY statement can reference only numeric data.
D. None, the DATA step fails because the ARRAY statement can reference only pre-existing variables.
Answer: A

In this datastep the array is creating 4 character variable sales1-sales
The following SAS program is submitted:

data work.test;
array agents{4} $ 12 sales1 - sales4;
run;

Which one of the following represents the variables that are contained in the output data set?

A. SALES1, SALES2, SALES3, SALES4
B. AGENTS1, AGENTS2, AGENTS3, AGENTS4
C. None, the DATA step fails because the ARRAY statement can reference only numeric data.
D. None, the DATA step fails because the ARRAY statement can reference only pre-existing variables.
Answer: A

In this datastep the array is creating 4 character variable sales1-sales
The following SAS program is submitted:

data stats;
set revenue;
array weekly{5} mon tue wed thu fri;

total = weekly{i} * .25;
output;
end;
run;

Which one of the following DO statements completes the program and processes the elements of the WEEKLY array?

A. do i = 1 to 5;
B. do weekly{i} = 1 to 5;
C. do i = mon tue wed thu fri;
D. A DO loop cannot be used because the variables referenced do not end in a digit.
Answer: A

In this datastep the array is creating 4 character variable sales1-sales
The following SAS program is submitted:

data stats;
set revenue;
array weekly{5} mon tue wed thu fri;

total = weekly{i} * .25;
output;
end;
run;

Which one of the following DO statements completes the program and processes the elements of the WEEKLY array?

A. do i = 1 to 5;
B. do weekly{i} = 1 to 5;
C. do i = mon tue wed thu fri;
D. A DO loop cannot be used because the variables referenced do not end in a digit.
Answer: A

In this datastep the array is creating 4 character variable sales1-sales
The following SAS program is submitted:


data work.totalsales (keep = monthsales{12} );
set work.monthlysales (keep = year product sales);
array monthsales {12} ;
do i=1 to 12;
monthsales{i} = sales;
end;
run;


The data set named WORK.MONTHLYSALES has one observation per month for each of five years for a total of 60 observations.


Which one of the following is the result of the above program?
A. The program fails execution due to data errors.
B. The program fails execution due to syntax errors.
C. The program executes with warnings and creates the WORK.TOTALSALES data set.
D. The program executes without errors or warnings and creates the WORK.TOTALSALES data set.
Answer: B

monthsales {12} is a wrong way to represent in the keep option…it should be monthsales1-monthsales12.
data work.totalsales (keep = monthsales{12} );
The following SAS program is submitted:


data work.totalsales (keep = monthsales{12} );
set work.monthlysales (keep = year product sales);
array monthsales {12} ;
do i=1 to 12;
monthsales{i} = sales;
end;
run;


The data set named WORK.MONTHLYSALES has one observation per month for each of five years for a total of 60 observations.


Which one of the following is the result of the above program?
A. The program fails execution due to data errors.
B. The program fails execution due to syntax errors.
C. The program executes with warnings and creates the WORK.TOTALSALES data set.
D. The program executes without errors or warnings and creates the WORK.TOTALSALES data set.
Answer: B

monthsales {12} is a wrong way to represent in the keep option…it should be monthsales1-monthsales12.
data work.totalsales (keep = monthsales{12} );
The contents of the raw data file AMOUNT are listed below:


--------10-------20-------30
$1,234

The following SAS program is submitted:


data test;
infile 'amount';
input @1 salary 6.;
if _error_ then description = 'Problems';
else description = 'No Problems';
run;

Which one of the following is the value of the DESCRIPTION variable?

A. Problems
B. No Problems
C. ' ' (missing character value)
D. The value cannot be determined as the program fails to execute due to errors.
Answer: A
The informat is not right 6. For $1,234 is not right….it should have been comma6.
The contents of the raw data file AMOUNT are listed below:


--------10-------20-------30
$1,234

The following SAS program is submitted:


data test;
infile 'amount';
input @1 salary 6.;
if _error_ then description = 'Problems';
else description = 'No Problems';
run;

Which one of the following is the value of the DESCRIPTION variable?

A. Problems
B. No Problems
C. ' ' (missing character value)
D. The value cannot be determined as the program fails to execute due to errors.
Answer: A
The informat is not right 6. For $1,234 is not right….it should have been comma6.
A raw data file is listed below:

--------10-------20-------30
John McCloskey 35 71
June Rosesette 10 43
Tineke Jones 9 37

The following SAS program is submitted using the raw data file as input:

data work.homework;
infile 'file-specification';
input name $ age height;
if age LE 10;
run;

How many observations will the WORK.HOMEWORK data set contain?
A. 0
B. 2
C. 3
D. No data set is created as the program fails to execute due to errors.
Answer: C
This is a tricky question…
The values for name have embedded blanks and also no length statement…so the values assigned for age is . (missing) for all obs. And also . (missing) is always le 10. Therefore the output dataset has 3 obs.
A raw data file is listed below:

--------10-------20-------30
John McCloskey 35 71
June Rosesette 10 43
Tineke Jones 9 37

The following SAS program is submitted using the raw data file as input:

data work.homework;
infile 'file-specification';
input name $ age height;
if age LE 10;
run;

How many observations will the WORK.HOMEWORK data set contain?
A. 0
B. 2
C. 3
D. No data set is created as the program fails to execute due to errors.
Answer: C
This is a tricky question…
The values for name have embedded blanks and also no length statement…so the values assigned for age is . (missing) for all obs. And also . (missing) is always le 10. Therefore the output dataset has 3 obs.
hich one of the following statements is true regarding the SAS automatic _ERROR_ variable?


A. The _ERROR_ variable contains the values 'ON' or 'OFF'.
B. The _ERROR_ variable contains the values 'TRUE' or 'FALSE'.
C. The _ERROR_ variable is automatically stored in the resulting SAS data set.
D. The _ERROR_ variable can be used in expressions or calculations in the DATA step.
Answer: D
The valid values of _ERROR_ is 0 or 1. This value can be used in expressions or calculations in the DATA step.
hich one of the following statements is true regarding the SAS automatic _ERROR_ variable?


A. The _ERROR_ variable contains the values 'ON' or 'OFF'.
B. The _ERROR_ variable contains the values 'TRUE' or 'FALSE'.
C. The _ERROR_ variable is automatically stored in the resulting SAS data set.
D. The _ERROR_ variable can be used in expressions or calculations in the DATA step.
Answer: D
The valid values of _ERROR_ is 0 or 1. This value can be used in expressions or calculations in the DATA step.
The following SAS program is submitted:


data work.totalsales (keep = monthsales{12} );
set work.monthlysales (keep = year product sales);
array monthsales {12} ;
do i=1 to 12;
monthsales{i} = sales;
end;
run;


The data set named WORK.MONTHLYSALES has one observation per month for each of five years for a total of 60 observations.


Which one of the following is the result of the above program?
A. The program fails execution due to data errors.
B. The program fails execution due to syntax errors.
C. The program executes with warnings and creates the WORK.TOTALSALES data set.
D. The program executes without errors or warnings and creates the WORK.TOTALSALES data set.
Answer: B

monthsales {12} is a wrong way to represent in the keep option…it should be monthsales1-monthsales12.
data work.totalsales (keep = monthsales{12} );
The following SAS program is submitted:


data work.totalsales (keep = monthsales{12} );
set work.monthlysales (keep = year product sales);
array monthsales {12} ;
do i=1 to 12;
monthsales{i} = sales;
end;
run;


The data set named WORK.MONTHLYSALES has one observation per month for each of five years for a total of 60 observations.


Which one of the following is the result of the above program?
A. The program fails execution due to data errors.
B. The program fails execution due to syntax errors.
C. The program executes with warnings and creates the WORK.TOTALSALES data set.
D. The program executes without errors or warnings and creates the WORK.TOTALSALES data set.
Answer: B

monthsales {12} is a wrong way to represent in the keep option…it should be monthsales1-monthsales12.
data work.totalsales (keep = monthsales{12} );