# Free A00-231 practice questions

> 10 free A00-231 practice questions with the correct answer and an explanation.

Page: https://devopscodelab.com/exams/sas-a00-231/free-practice-questions/
Practice exams: https://devopscodelab.com/exams/sas-a00-231/

### Question 1 of 10

A comma-delimited file contains the line 101,"Smith, Ann",,45. The programmer wants SAS to keep "Smith, Ann" as one value without quotation marks and to read the empty field between the two consecutive commas as a missing value. Which INFILE option should be added?

- A. DSD
- B. TRUNCOVER
- C. MISSOVER
- D. DLM=','

**Answer:** A

**Explanation:** DSD treats consecutive delimiters as a missing value, removes quotation marks from quoted values, ignores delimiters inside quotes, and uses a comma as the default delimiter. DLM=',' alone treats consecutive commas as a single delimiter and splits the quoted name. MISSOVER and TRUNCOVER control what happens when a record is shorter than the INPUT statement expects; they do not handle quotes or empty fields.

### Question 2 of 10

PROC IMPORT reads a CSV file in which some city names after row 500 are longer than any earlier value, and those names are truncated in the output data set. Which statement in the PROC IMPORT step prevents this?

- A. datarow=1;
- B. getnames=no;
- C. replace;
- D. guessingrows=max;

**Answer:** D

**Explanation:** PROC IMPORT sets column types and lengths from a sample of rows (20 by default), so values longer than anything in the sample are truncated; GUESSINGROWS=MAX scans every row before setting lengths. GETNAMES=NO reads the header row as data, DATAROW=1 also starts reading at the header line, and REPLACE only allows an existing output data set to be overwritten.

### Question 3 of 10

A programmer wants to keep only the first order for each customer_id in work.orders and save the removed orders in a separate data set. Which step does this?

- A. proc sort data=orders out=first nodupkey dupout=extra; by customer_id; run;
- B. proc sort data=orders out=first nodupkey; by _all_; run;
- C. proc sort data=orders out=first dupout=extra; by customer_id _all_; run;
- D. proc sort data=orders out=first noduprecs dupout=extra; by customer_id; run;

**Answer:** A

**Explanation:** NODUPKEY keeps only the first observation for each unique BY value, and DUPOUT= writes the removed observations to another data set. NODUPRECS removes only observations that are identical in every variable to the previous one, DUPOUT= has no effect without NODUPKEY or NODUPRECS, and BY _ALL_ with NODUPKEY removes only complete duplicates instead of extra orders per customer.

### Question 4 of 10

Consider this step. What are the value and the length of yr?
data codes;
   code = 'AB-2026-XY';
   yr = substr(code, 4, 4);
run;

- A. 2026 with a length of 4
- B. 2026 with a length of 200
- C. 2026 with a length of 10
- D. -202 with a length of 4

**Answer:** C

**Explanation:** SUBSTR starting at position 4 for 4 characters returns 2026, and a new variable created by SUBSTR gets the length of the source variable, which is 10 here because code was assigned a 10-character literal. A length of 4 would require a LENGTH statement, -202 would start at position 3, and 200 is the default length for functions such as SCAN and CATX, not SUBSTR.

### Question 5 of 10

The variable phone contains values such as (555) 123-4567 ext. 9. Which function call returns only the digits, 55512345679?

- A. compress(phone, 'ext. ')
- B. compress(phone, , 'd')
- C. compress(phone, , 'kd')
- D. compress(phone, '()- ')

**Answer:** C

**Explanation:** The third argument of COMPRESS lists modifiers; k means keep instead of remove, and d means digits, so 'kd' keeps only digits. Removing parentheses, hyphens, and blanks still leaves the letters and period of ext., the d modifier alone removes the digits, and removing the characters e, x, t, the period, and the blank still leaves the parentheses and the hyphen.

### Question 6 of 10

Which WHERE statement selects observations where code is exactly four characters long and begins with A, such as A1B2?

- A. where code like 'A___'; with three underscores
- B. where code like 'A%'; with one percent sign after the A
- C. where code =: 'A'; using the prefix comparison operator
- D. where code contains 'A___'; with three underscores

**Answer:** A

**Explanation:** The underscore in a LIKE pattern matches exactly one character, so 'A___' matches A followed by exactly three characters (trailing blanks are ignored). The percent sign matches any number of characters, so 'A%' also matches codes of any other length, CONTAINS treats the underscores as literal characters, and the =: operator matches every code that starts with A regardless of length.

### Question 7 of 10

This step stops with the error "Variable bonus is not on file WORK.STAFF". What change produces the intended subset?
data highpay;
   set work.staff;
   bonus = salary * 0.1;
   where bonus > 5000;
run;

- A. Add bonus to a KEEP= data set option on SET
- B. Add a RETAIN statement for bonus before SET
- C. Replace the WHERE statement with if bonus > 5000;
- D. Move the WHERE statement above the SET statement

**Answer:** C

**Explanation:** A WHERE statement filters observations as they are read, so it can only reference variables that exist in the input data set, and bonus is created later in the step. A subsetting IF is evaluated during execution after the assignment, so it can use the new variable. Moving WHERE has no effect because it is not executable, KEEP= cannot keep a variable that is not in the input, and RETAIN does not add bonus to the input data.

### Question 8 of 10

work.orders contains price and qty but no total. Why does this step create a data set with 0 observations?
data big;
   set work.orders;
   if total > 100;
   total = price * qty;
run;

- A. The assignment must come before SET for total to exist in the PDV
- B. The step needs a KEEP statement for total before the IF statement
- C. The subsetting IF cannot reference a variable created in the same step
- D. total is missing when the IF statement runs, so every observation is deleted

**Answer:** D

**Explanation:** Statements execute in order, and total is reset to missing at the start of each iteration, so it is missing when the subsetting IF tests it; missing is not greater than 100 and every observation is deleted. Moving the assignment above the IF fixes the logic. A subsetting IF can use new variables when they are assigned first, and neither moving the assignment above SET nor adding KEEP helps.

### Question 9 of 10

A report must show column labels instead of variable names and must not show the Obs column. Which PROC PRINT statement does this?

- A. proc print data=work.emp label noobs;
- B. proc print data=work.emp labels obs=0;
- C. proc print data=work.emp split noobs;
- D. proc print data=work.emp nolabel id;

**Answer:** A

**Explanation:** PROC PRINT uses variable labels as column headings only when LABEL (or SPLIT=) is specified, and NOOBS suppresses the Obs column. SPLIT needs a split character such as SPLIT='*', OBS=0 prints no observations at all, and NOLABEL with ID neither turns on labels nor removes the Obs column, because ID is a separate statement rather than a PROC PRINT option.

### Question 10 of 10

An ODS EXCEL report must put the output on a worksheet named Summary. Which statement does this?

- A. ods excel file='/rpt/r.xlsx' style=Summary;
- B. ods excel file='/rpt/r.xlsx' title='Summary';
- C. ods excel file='/rpt/r.xlsx' options(sheet_name='Summary');
- D. ods excel file='/rpt/r.xlsx' sheet='Summary' sheet_interval='none';

**Answer:** C

**Explanation:** ODS EXCEL takes destination-specific suboptions in OPTIONS( ), and SHEET_NAME= names the worksheet. SHEET= is a PROC IMPORT and PROC EXPORT statement rather than an ODS option, and SHEET_INTERVAL= is only valid inside OPTIONS( ), STYLE= selects a style template, and TITLE= sets document properties rather than the sheet name.

Ready for a timed run? Take the free 15-question A00-231 mini exam: https://devopscodelab.com/app/exams/sas-a00-231/mini/

DevOpsCode Lab is not affiliated with SAS. A00-231 and related names are trademarks of their owners. We write every question ourselves; these are not real exam questions.
