Use VCE Exam Simulator to open VCE files

A00-211 SAS Institute Practice Test Questions and Exam Dumps
Question 1
The SAS data set SASUSER.HOUSES contains a variable PRICE which has been assigned a permanent label of "Asking Price". Which SAS program 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; price = "Sale Price"; run;
Answer: C
Explanation:
In SAS, variable labels provide descriptive information about variables for display in output, such as in PROC PRINT. A label assigned permanently in the data set can be temporarily overridden in procedures by using a LABEL statement within a PROC step.
In this question, the variable PRICE already has a permanent label of "Asking Price". The goal is to temporarily override this label for a specific PROC PRINT run, replacing it with "Sale Price" in the output.
Let’s evaluate each option to see which one correctly performs this temporary label override:
A. proc print data = sasuser.houses; label price = "Sale Price"; run;
This syntax appears close, but it's missing the keyword label on the proc print statement, which is needed to activate label printing in output. Without it, SAS will print the variable names, not their labels.
B. proc print data = sasuser.houses label; label price "Sale Price"; run;
This option includes the label keyword on the proc print line (which is correct), but the LABEL statement syntax is incorrect—it misses the equals sign (=). SAS requires label price = "Sale Price";.
C. proc print data = sasuser.houses label; label price = "Sale Price"; run;
This is the correct answer. It includes both:
label in the PROC PRINT statement to tell SAS to print labels instead of variable names.
A proper label statement that temporarily assigns "Sale Price" as the label for the variable PRICE.
D. proc print data = sasuser.houses; price = "Sale Price"; run;
This is completely invalid SAS syntax. You cannot assign labels like this inside PROC PRINT. This would result in a syntax error.
Therefore, C is the correct SAS program that temporarily overrides the permanent label "Asking Price" with "Sale Price" for the PRICE variable in the printed output.
Question 2
The following SAS program is submitted:
data work.empsalary;
set work.people (in = inemp)
work.money (in = insal);
if insal and inemp;
run;
The SAS data set WORK.PEOPLE has 5 observations, and the data set WORK.MONEY has 7 observations. How many observations will the data set WORK.EMPSALARY contain?
A. 0
B. 5
C. 7
D. 12
Answer: A
Explanation:
This SAS program uses a SET statement to read from two datasets: WORK.PEOPLE and WORK.MONEY. The IN= data set option creates temporary Boolean variables—inemp and insal—that are set to 1 (true) if the current observation is being read from the respective dataset, and 0 (false) otherwise.
Here’s the detailed breakdown:
set work.people (in = inemp) work.money (in = insal);
This tells SAS to concatenate the datasets—first it reads all 5 observations from work.people, then all 7 observations from work.money.
if insal and inemp;
This condition tells SAS to only keep observations where both inemp and insal are true. In other words, it will only output observations that came simultaneously from both work.people and work.money.
However, since SAS processes datasets sequentially, each observation is read from only one of the datasets at a time. Therefore:
When reading from work.people, inemp = 1 and insal = 0
When reading from work.money, inemp = 0 and insal = 1
At no point will an observation be read where both inemp and insal are true for the same row. Thus, the condition if insal and inemp; will never be true.
Therefore, no observations meet the condition, and the resulting dataset work.empsalary will contain 0 observations.
This is a common misunderstanding for new SAS users—the IN= variables are mutually exclusive within a single SET statement combining multiple datasets.
Hence, the correct answer is A.
Question 3
The following SAS program is submitted:
data work.accounting;
set work.dept1 work.dept2;
jobcode = "FA1";
length jobcode $ 8;
run;
A character variable named JOBCODE is contained in both the WORK.DEPT1 and WORK.DEPT2 SAS data sets. The variable JOBCODE has a length of 5 in the WORK.DEPT1 data set and a length of 7 in the WORK.DEPT2 data set.
What is the length of the variable JOBCODE in the output data set?
A. 3
B. 5
C. 7
D. 8
Answer: C
Explanation:
In SAS, the length of a character variable is determined at the point of its first reference in the DATA step. Once the length is established, it cannot be changed later within that step—even by using a LENGTH statement or assigning a longer value.
Let's analyze the program step-by-step to understand when and how the length of JOBCODE is determined:
This line brings in the variable JOBCODE from both datasets:
From work.dept1: JOBCODE has length 5
From work.dept2: JOBCODE has length 7
When using the SET statement with multiple datasets, SAS determines the variable attributes from the first dataset in the list that contains the variable. In this case, since work.dept1 comes first and has JOBCODE with length 5, SAS sets the length of JOBCODE in the PDV (Program Data Vector) to 5 at this point.
However, this rule does not apply when variables are present in both datasets with differing lengths. In such cases, SAS uses the longest length across all datasets in the SET statement.
So even though JOBCODE comes from both datasets, SAS compares the lengths (5 from dept1, 7 from dept2) and assigns the variable the maximum length, which is 7.
This assignment is irrelevant to length; SAS will simply store "FA1" in the existing JOBCODE variable (which is already length 7) and pad it with blanks.
This line comes after JOBCODE has already been defined by the SET statement, so it has no effect. You cannot change a variable’s length after it’s already been created. The LENGTH statement must appear before the first reference (including the SET statement) to have any effect.
The variable JOBCODE will have a length of 7 in the output data set, because SAS assigns the maximum length found across all contributing datasets in the SET statement when conflicting lengths are present.
Therefore, the correct answer is C.
Question 4
Given the SAS data set SASDATA.TWO:
The following SAS program is submitted:
data sasuser.one two sasdata.three;
set sasdata two;
if x = 5 then output sasuser.one;
else output sasdata two;
run;
What is the result?
A. data set SASUSER.ONE has 5 observations, SASUSER.TWO has 5 observations, data set WORK.OTHER has 3 observations
B. data set SASUSER.ONE has 2 observations, SASUSER.TWO has 2 observations, data set WORK.OTHER has 1 observation
C. data set SASUSER.ONE has 2 observations, SASUSER.TWO has 2 observations, data set WORK.OTHER has 5 observations
D. No data sets are output. The DATA step fails execution due to syntax errors.
Answer: D
Explanation:
To determine the correct result, let's analyze the provided SAS program line by line and identify both the logical behavior and any syntax issues.
data sasuser.one two sasdata.three;
This line indicates that the DATA step is intended to create three datasets:
sasuser.one
work.two (since no libref is specified, defaults to WORK)
sasdata.three
This part of the line is syntactically correct.
set sasdata two;
Here is the critical error.
The programmer intended to write:
set sasdata.two;
Instead, they wrote:
set sasdata two;
This is a syntax error. SAS is trying to interpret sasdata as one dataset and two as another, but sasdata by itself is a libref, not a dataset. SAS does not allow splitting the libref and dataset name across separate tokens like this. The correct syntax must combine the libref and dataset name using a period (.): sasdata.two.
As a result, the DATA step fails compilation, and no datasets are created or output.
Let’s briefly address why the other choices are incorrect:
A, B, and C all assume that the DATA step runs successfully and produces datasets. But due to the syntax error, the step never runs, so no datasets are created at all.
Because of the incorrect syntax in the SET statement, SAS will issue an error message and stop processing the DATA step entirely. No output datasets will be created.
Therefore, the correct answer is D.
Question 5
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 footnote(s) is/are 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: D
Explanation:
In SAS, the FOOTNOTE statement is used to define lines of footnotes that appear at the bottom of each page of output. You can define up to 10 footnotes using FOOTNOTE1 through FOOTNOTE10. These are displayed in order, starting with FOOTNOTE1 at the top and ending with the highest-numbered footnote at the bottom.
The key behavior to understand here is how redefining a footnote works:
When you assign a value to a FOOTNOTE (like FOOTNOTE2 "All Products"), SAS replaces the previous content of that specific footnote with the new text.
It does not affect the other footnotes unless they are also explicitly redefined.
Now let’s analyze the sequence of operations:
footnote1 "Sales Report for Last Month";
footnote2 "Selected Products Only";
footnote3 "All Regions";
footnote4 "All Figures in Thousands of Dollars";
This sets up 4 footnotes:
Footnote1: "Sales Report for Last Month"
Footnote2: "Selected Products Only"
Footnote3: "All Regions"
Footnote4: "All Figures in Thousands of Dollars"
footnote2 "All Products";
Here, only footnote2 is redefined, replacing "Selected Products Only" with "All Products". The rest of the footnotes remain unchanged.
Therefore, when the PROC PRINT step executes, the footnotes displayed in the output will be:
Footnote1: "Sales Report for Last Month"
Footnote2: "All Products" (overridden)
Footnote3: "All Regions"
Footnote4: "All Figures in Thousands of Dollars"
So, the report footer will display the following lines in this exact order:
Sales Report for Last Month
All Products
All Regions
All Figures in Thousands of Dollars
Thus, the correct answer is D.
Question 6
Given the raw data record DEPT:
----|----10---|----20---|----30
Printing 750 -
The following SAS program is submitted:
data bonus;
infile "dept";
input dept $ 1-11 number 13-15;
<insert statement here>
run;
Which SAS statement completes the program and results in a value of "Printing750" for the DEPARTMENT variable?
A. department = dept || number;
B. department = left(dept) || number;
C. department = trim(dept) number;
D. department = trim(dept) || put(number, 3.);
Answer: D
Explanation:
To solve this, we need to understand how to correctly concatenate a character string (dept) with a numeric value (number) in SAS to form a new character variable (department) that reads as "Printing750".
Let’s break down each part of the question:
Printing 750 -
123456789012345678901234567890
dept is read from columns 1–11, which includes the word "Printing" followed by spaces.
number is read from columns 13–15, which is 750.
So after the input statement:
dept = "Printing " (with trailing spaces to fill 11 columns)
number = 750 (a numeric value)
We want to construct:
department = "Printing750" (a character string, no spaces between the words and number)
A. department = dept || number;
This will cause a type mismatch error. You cannot concatenate a character (dept) and a numeric (number) directly. SAS will not implicitly convert numeric values to character in string concatenation.
B. department = left(dept) || number;
Same issue as above: SAS will throw an error because number is numeric, and you're trying to concatenate it with a character value using ||.
C. department = trim(dept) number;
This is invalid syntax. You can’t place two expressions side by side like that. There's no concatenation operator || here, so SAS doesn't know what to do with the two values. This line will cause a syntax error.
D. department = trim(dept) || put(number, 3.);
This is the correct approach. Here’s why:
trim(dept) removes trailing spaces from the character variable.
put(number, 3.) converts the numeric value to a character string with width 3.
|| is the string concatenation operator.
This results in "Printing750" as a character string with no spaces between the text and number.
The only correct way to remove extra spaces and combine a character and numeric variable into a single character string is with:
department = trim(dept) || put(number, 3.);
So, the correct answer is D.
Question 7
The following SAS program is submitted:
data one;
address1 = "214 London Way";
run;
data one;
set one;
address = tranwrd(address1, "Way", "Drive");
run;
What are the length and value of the variable ADDRESS?
A. Length is 14; value is "214 London Dri"
B. Length is 14; value is "214 London Way"
C. Length is 16; value is "214 London Drive"
D. Length is 200; value is "214 London Drive"
Answer: A
Explanation:
To determine the length and value of the variable ADDRESS, we must understand how string handling works in SAS, especially regarding:
Default lengths of character variables
The behavior of the TRANWRD function
How variable length is assigned in a DATA step
Let’s analyze the code step-by-step.
data one;
address1 = "214 London Way";
run;
Here:
address1 is created with the value "214 London Way", which has 14 characters (including the space).
Since there is no length statement, SAS assigns address1 a length of 14, based on the first assignment.
data one;
set one;
address = tranwrd(address1, "Way", "Drive");
run;
Here:
tranwrd(address1, "Way", "Drive") replaces the substring "Way" with "Drive", producing "214 London Drive" (16 characters).
However, no length statement is provided for the new variable address.
Character variables created in a DATA step by assignment (not input or length statement) take on the length of the first assigned value.
In this case, SAS sees the tranwrd function result and attempts to assign that to address, a new character variable.
But SAS doesn't know the function’s return value length, so it assigns the default length of 200 to character variables only when reading from an external file or certain other operations — not here.
Instead, SAS uses the length of the first assignment's result—which is tranwrd(address1, "Way", "Drive").
Here is the catch: SAS does not adjust the length of address to the full length of the result if the function returns a longer string than expected.
In this case:
The original address1 was 14 characters long.
The result of tranwrd(...) is 16 characters: "214 London Drive"
But because address is created implicitly from the function call, SAS assigns it the same length as address1, i.e., 14.
Since address only has 14 characters of space, but "214 London Drive" is 16 characters, SAS truncates the result to 14 characters:
"214 London Dri" (first 14 characters of the longer result)
address has length = 14
address contains "214 London Dri"
The correct answer is A:
Length is 14; value is "214 London Dri"
Question 8
The following SAS program is submitted:
data work.sets;
do until (prod gt 6);
prod + 1;
end;
run;
What is the value of the variable PROD in the output data set?
A. 6
B. 7
C. 8
D. (missing numeric)
Answer: B
Explanation:
To determine the final value of the variable PROD, we need to understand how the DO UNTIL loop and accumulation (+) operator work in SAS.
do until (prod gt 6);
prod + 1;
end;
Let’s go step by step:
This loop continues executing until the condition becomes true.
The condition is checked after each loop iteration. That means the loop executes at least once, even if the condition is already true.
This uses the sum statement (not a simple assignment).
The sum statement prod + 1; automatically:
Initializes prod to 0 on the first iteration if it is not previously defined.
Retains the value of prod across iterations (like using the retain statement).
Adds 1 to prod on each loop iteration.
Let’s walk through each iteration:
So the loop stops after prod becomes 7, which is when prod > 6 evaluates as true.
After the loop finishes, the value of prod is 7, and that is what gets written to the output data set.
The + operator in prod + 1; is a sum statement, not a typical addition.
The DO UNTIL loop always runs at least once and checks the condition after the body executes.
prod was initialized to 0 and incremented until it became greater than 6.
When prod = 7, the loop exited, and that value was saved.
Question 9
The SAS data sets WORK.EMPLOYEE and WORK.SALARY are as follows:
WORK.EMPLOYEE
WORK.SALARY
The following SAS program is submitted:
sas
CopyEdit
data work.empdata;
by fname;
totsal + salary;
run;
Which one of the following statements completes the merge of the two data sets by the FNAME variable?
A. merge work.employee work.salary (fname = name);
B. merge work.employee work.salary (name = fname);
C. merge work.employee work.salary (rename = (fname = name));
D. merge work.employee work.salary (rename = (name = fname));
Answer: D
Explanation:
To solve this question correctly, let’s walk through the intended functionality, merge mechanics, and how renaming works in SAS.
You are merging two data sets:
WORK.EMPLOYEE, which has a variable fname
WORK.SALARY, which has a variable name
You want to merge by the common key, but they do not share the same variable name (fname ≠ name), even though the values (e.g., "Bruce", "Dan") are the same.
SAS merges based on common variable names when using a BY statement. But in this case:
The BY fname; statement means the data sets must both contain a variable named fname.
So you must rename the name variable in WORK.SALARY to fname, before the merge, so both data sets have a fname variable.
You use the RENAME= data set option to rename name to fname on the input data set WORK.SALARY.
Here’s the correct merge syntax:
merge work.employee work.salary(rename = (name = fname));
This means:
WORK.EMPLOYEE keeps fname
WORK.SALARY renames name → fname during the merge
Now both data sets share the variable fname, allowing the merge BY fname to work properly
A. merge work.employee work.salary (fname = name);
This is invalid syntax. You cannot assign a variable like that inside the parentheses.
B. merge work.employee work.salary (name = fname);
Again, this is not valid SAS syntax. name = fname is not a valid rename or merge instruction.
C. merge work.employee work.salary (rename = (fname = name));
This is the opposite of what you want—it would rename fname in EMPLOYEE to name, but the BY fname; line expects fname to exist in both datasets.
D. merge work.employee work.salary (rename = (name = fname));
This is the correct form. It renames name from WORK.SALARY to fname, aligning it with WORK.EMPLOYEE, so BY fname will work.
Question 10
Which program displays a listing of all data sets in the SASUSER library?
A. proc contents lib = sasuser.all; run;
B. proc contents data = sasuser.all; run;
C. proc contents lib = sasuser.alI; run;
D. proc contents data = sasuser.all; run;
Answer: D
Explanation:
To answer this correctly, we must understand how the PROC CONTENTS procedure works in SAS and what syntax is used to display all data sets in a given library.
PROC CONTENTS provides details about a SAS data set or all data sets within a library. It is commonly used to:
View the structure of a data set (e.g., variable names, types, lengths)
List all data sets within a library
To list all data sets in a library, you must use the _ALL_ keyword along with the DATA= or LIB= options appropriately.
Let’s evaluate each option:
proc contents lib = sasuser.all; run;
This is invalid syntax. The LIB= option is used to specify a library name, not a data set name or keyword. sasuser.all implies a data set named all in the sasuser library, which doesn’t make sense as a library reference.
proc contents data = sasuser.all; run;
This is also invalid, unless there exists a data set named all in the sasuser library. But the question requires a listing of all data sets, not just one.
proc contents lib = sasuser._alI_; run;
This looks almost correct, but notice the subtle mistake: _alI_ uses a capital 'I' instead of a lowercase 'l', likely a typographical trick. _ALL_ is a special keyword recognized by SAS (case-insensitive) to refer to all data sets, but _alI_ is not recognized and would cause an error.
proc contents data = sasuser._all_; run;
This is the correct answer.
Here’s why:
DATA = sasuser._all_ tells SAS to retrieve contents information for all data sets in the sasuser library.
_ALL_ is a special keyword in SAS (not case-sensitive) that indicates all data sets within a specified library.
This form produces a report listing each data set and its variables in the specified library.
_ALL_ is the correct keyword to list all data sets.
DATA= is the proper option to use when referencing _ALL_ for a library.
Option D correctly applies both principles.
Top Training Courses
LIMITED OFFER: GET 30% Discount
This is ONE TIME OFFER
A confirmation link will be sent to this email address to verify your login. *We value your privacy. We will not rent or sell your email address.
Download Free Demo of VCE Exam Simulator
Experience Avanset VCE Exam Simulator for yourself.
Simply submit your e-mail address below to get started with our interactive software demo of your free trial.