Home / SAS Certified Specialist: Base Programming (A00-231) / Mock exam
SAS Certified Specialist: Base Programming (A00-231) Exam-style mock test

SAS Base Programming (A00-231) Practice Exams|Practice test

Full explanations Exam format Pass line 70%
33 USD One-time · lifetime access
Enroll →

Sample questions

Example1 · SAS Programming Fundamentals & DATA Step
A programmer at CloudHub, a B2B SaaS company, writes a SAS program that reads raw subscription records and builds a new dataset of active accounts. Which statement best characterizes the role of the DATA step in this program?
・It launches an external reporting engine that formats the subscription records into printed PDF output files
Incorrect. Producing printed or PDF output is the role of procedures such as PROC PRINT or ODS, not the DATA step itself.
✓It reads, manipulates, and writes observations to create or modify a SAS dataset for later use
Correct. The DATA step reads input, processes it observation by observation, and writes rows to create or modify a SAS dataset.
・It defines permanent storage locations so the dataset survives after the SAS session ends
Incorrect. Permanent storage is defined by a LIBNAME statement that assigns a libref, not by what the DATA step inherently does.
・It summarizes the subscription records by computing totals and group statistics automatically
Incorrect. Automatic summarization by group is the job of procedures like PROC MEANS or PROC SUMMARY, not the DATA step.
Explanation
The DATA step is where SAS reads, transforms, and outputs observations to build or change datasets; reporting and summarizing are handled by PROC steps.
Example2 · Accessing & Importing Data
A SaaS analyst receives a comma-delimited file of subscription records where some character fields contain embedded commas inside quotes. Which INFILE option combination correctly reads these values as a single field?
✓Use INFILE with DLM=',' and the DSD option so quoted delimiters are treated as data and quotes are stripped
Correct. The DSD option treats delimiters inside quotes as part of the data value and removes the enclosing quotation marks, correctly reading the field.
・Use INFILE with the DLM=',' option only, relying on list input to ignore any quotation marks present
Incorrect. DLM=',' alone splits on every comma, so an embedded comma inside quotes would incorrectly break the value into two fields.
・Use INFILE with the TRUNCOVER option alone, which automatically handles commas that appear inside quoted strings
Incorrect. TRUNCOVER only controls behavior when a record is shorter than expected; it does not interpret quoted delimiters as data.
・Use INFILE with DLM=',' plus the MISSOVER option so embedded commas are read and surrounding quotes retained
Incorrect. MISSOVER addresses short records and does not treat quoted commas as data, so the embedded comma would still split the field.
Explanation
The DSD option is specifically designed to handle delimiters appearing within quoted values and to strip the quotation marks, making it the correct choice for this comma-in-quotes situation.
Example3 · Creating & Manipulating Data Structures
A SaaS analyst at CloudMetric Inc. runs a DATA step beginning with the statement DATA sales.q3_renewals work.audit;. After the step completes successfully, which statement correctly describes the two output data sets that were created?
・Both q3_renewals and audit are stored permanently in the library pointed to by the SALES libref and persist after the session
Incorrect. Only q3_renewals is qualified with the SALES libref; audit is a one-level name assigned to the temporary WORK library, not a permanent SALES member.
✓The q3_renewals set is written to the SALES library permanently while audit is written to the temporary WORK library and is deleted at session end
Correct. A two-level name (sales.q3_renewals) stores the set permanently in the SALES library, while a one-level name (audit) defaults to WORK and is cleared when the session ends.
・Both q3_renewals and audit are temporary sets placed in WORK because a single DATA step can produce only one permanent output data set at a time
Incorrect. A DATA step can create multiple output data sets, and a two-level name does place q3_renewals permanently, so neither set is forced into WORK by that limitation.
・The audit set replaces q3_renewals in the SALES library because the WORK keyword forces both outputs into the same permanent destination
Incorrect. The WORK keyword does not force outputs into SALES, and the two named sets are independent members rather than one replacing the other.
Explanation
A two-level name libref.member creates a permanent data set in the named library; a one-level name defaults to the temporary WORK library, which is deleted at the end of the session.
Example4 · Combining & Summarizing Data
A health services analyst has two data sets, CLINIC_Q1 and CLINIC_Q2, each with the same variables PatientID, VisitDate, and Charge. She needs ONE data set holding every visit from both quarters. Which DATA step correctly stacks all observations from both quarters?
・data all_visits; merge clinic_q1 clinic_q2; by patientid; run;
Incorrect. MERGE performs a one-to-one or match-merge joining variables side by side, not stacking all observations end to end from both quarters.
✓data all_visits; set clinic_q1 clinic_q2; run;
Correct. A single SET statement listing both data sets concatenates them, reading all observations from CLINIC_Q1 then all from CLINIC_Q2 into ALL_VISITS.
・data all_visits; set clinic_q1; set clinic_q2; run;
Incorrect. Two separate SET statements read one observation from each in parallel and stop early, which interleaves and truncates rather than stacking all rows.
・proc append base=all_visits data=clinic_q1 clinic_q2 force; run;
Incorrect. PROC APPEND accepts only a single DATA= data set per step, so naming two data sets on DATA= is invalid syntax here.
Explanation
Listing multiple data sets on one SET statement is the standard concatenation technique: all observations from the first are read, then all from the second.
Example5 · Reporting, Formats & Error Handling
An analyst at a healthcare services firm runs PROC PRINT on the CLAIMS data set, which has a numeric observation sequence that the analyst does not want printed. The analyst also wants a column of row totals labeled 'Claim #'. Which statement combination produces a report with sequential row numbers labeled 'Claim #' instead of the default OBS column?
・Specify the NOOBS option together with an ID statement that names the sequence variable
Incorrect. NOOBS suppresses the OBS column, but without a LABEL the ID variable's header is just its name, so it cannot read 'Claim #'.
・Use the ID statement with the claim sequence variable and apply a LABEL to rename the OBS column header
Incorrect. Using ID alone does not suppress the default OBS column, so both columns would appear and the header would not be controlled as intended.
✓Specify NOOBS and add an ID statement naming the sequence variable with a LABEL assigning 'Claim #'
Correct. NOOBS removes the default OBS column, ID places the sequence variable at the left, and the LABEL changes its header to 'Claim #' as required.
・Use only the VAR statement listing every variable and rely on the default OBS numbering column
Incorrect. The VAR statement alone keeps the default OBS column and provides no way to relabel it to 'Claim #'.
Explanation
Suppressing OBS requires NOOBS, placing a specific identifier column requires ID, and a custom header requires LABEL; all three are needed together.
Example6 · SAS Programming Fundamentals & DATA Step
A programmer at Meridian Health Services is reviewing a colleague's SAS program that reads raw admissions data and then produces a summary table. The program contains one DATA step followed by one PROC MEANS step. Which statement best describes the respective roles of these two step types in this workflow?
・The DATA step defines report titles and footnotes while the PROC step reads and creates the SAS data set used for analysis of admissions
Incorrect. Titles and footnotes are set with global TITLE/FOOTNOTE statements, and it is the DATA step (not the PROC step) that reads raw data and builds the data set.
・Both the DATA step and the PROC step read raw admissions data, but only the PROC step is capable of writing a permanent SAS data set
Incorrect. Only the DATA step reads raw external data and builds data sets; PROC steps consume existing SAS data sets rather than reading raw admissions files.
✓The DATA step reads the raw admissions data and creates a SAS data set, and the PROC step analyzes that data set and reports the admissions results
Correct. The DATA step builds a SAS data set from the raw admissions data, and the PROC step then processes that data set to analyze and report results.
・The DATA step and the PROC step both summarize the admissions data, and SAS merges their two outputs into a single combined report
Incorrect. The DATA step does not summarize data in this workflow, and SAS does not automatically merge separate step outputs into one report.
Explanation
A SAS program is organized into DATA steps, which read and create SAS data sets, and PROC steps, which analyze and report on existing data sets. Here the DATA step builds the data and PROC MEANS summarizes it.
Example7 · SAS Programming Fundamentals & DATA Step
A programmer at UrbanThread, a clothing retailer, must list every variable in the permanent data set STORE.SALES along with each variable's type, length, and position in the data set, without printing any observations. Which PROC CONTENTS submission produces exactly this metadata report?
・PROC CONTENTS DATA=STORE.SALES; RUN;
Incorrect. The default PROC CONTENTS lists variables in alphabetical order and does not add the creation-order position column that the task requires.
✓PROC CONTENTS DATA=STORE.SALES POSITION; RUN;
Correct. The POSITION option adds a second listing of the variables in the order they are defined in the data set, alongside each variable's type, length, and position, and PROC CONTENTS never prints observations.
・PROC CONTENTS DATA=STORE.SALES VARNUM OBS=0; RUN;
Incorrect. VARNUM is not a valid PROC CONTENTS option and OBS= does not apply, so this submission does not run as written to produce the report.
・PROC CONTENTS DATA=STORE.SALES SHORT ORDER; RUN;
Incorrect. SHORT collapses the output to a bare variable-name list and ORDER is not a valid option, so the requested type, length, and position columns are suppressed.
Explanation
PROC CONTENTS reports only descriptor (metadata) information and never observations; the POSITION option supplies the creation-order listing showing type, length, and position.
Example8 · SAS Programming Fundamentals & DATA Step
During a code review at UrbanThread, a junior programmer asks why a free-format DATA step that spreads a single SAS statement across three physical lines with inconsistent indentation still compiles without error. Which characteristic of SAS statement syntax best explains this behavior?
・SAS statements must each begin in the first column of a new physical line to be recognized by the compiler.
Incorrect. SAS does not require statements to start in column one; statements can begin anywhere on a line.
✓SAS statements are free-format, so one statement may span multiple lines and the semicolon marks its end.
Correct. SAS uses free-format syntax, allowing a statement to continue across several lines or share a line, with the terminating semicolon defining where the statement ends.
・SAS statements require a RUN boundary on every physical line so that each line is parsed as its own statement.
Incorrect. RUN is a step boundary submitted once per step, not a per-line requirement, so this does not explain the behavior.
・SAS statements ignore semicolons entirely and instead rely on line breaks to separate one statement from the next.
Incorrect. The semicolon, not the line break, is the statement terminator, so claiming semicolons are ignored is wrong.
Explanation
SAS is a free-format language: statements can start and end anywhere, span multiple lines, and are delimited by semicolons rather than by physical line positions.
Example9 · SAS Programming Fundamentals & DATA Step
UrbanThread stores in-stream records where each line holds a store name, a numeric region code, and a sale amount separated by commas, and the store name may contain embedded spaces. Which INFILE/INPUT combination correctly reads these comma-delimited records into the variables STORE, REGION, and AMOUNT?
・INFILE DATALINES DLM=','; INPUT STORE $ REGION AMOUNT;
Incorrect. DLM=',' changes the delimiter but without DSD it treats each embedded space as an additional delimiter, splitting the store name across variables.
✓INFILE DATALINES DSD; INPUT STORE $ REGION AMOUNT;
Correct. The DSD option treats the comma as the delimiter, correctly handles the character field containing spaces as a single value, and reads STORE, REGION, and AMOUNT in order.
・INFILE DATALINES; INPUT STORE $20. REGION AMOUNT;
Incorrect. Without specifying the comma delimiter, list input uses blanks as delimiters, so the comma-delimited line is not parsed into three fields.
・INFILE DATALINES DLM=',' MISSOVER; INPUT STORE REGION $ AMOUNT;
Incorrect. Placing the $ on REGION rather than STORE assigns the character marker to the wrong variable, misreading the numeric region code and the store name.
Explanation
The DSD option on INFILE treats commas as delimiters and allows list input to read delimited character values that contain embedded blanks as single fields.
Example10 · SAS Programming Fundamentals & DATA Step
A programmer at MeridianTrust Bank submits a DATA step and finds the note 'Invalid data for Balance in line 42' repeated in the SAS log, yet the program runs to completion and produces an output data set. What does this situation most likely indicate about the job?
✓The program compiled and executed, but character values appeared where numeric values were expected, so SAS assigned missing values to Balance for those records.
Correct. 'Invalid data' is a note, not an error; execution continues, the record's numeric field is set to missing, and _ERROR_ is flagged while the job still finishes successfully.
・The DATA step failed to compile because of a reference to an undeclared variable, and the output data set was produced entirely from a previous run.
Incorrect. An undeclared variable does not stop compilation in SAS, and an 'Invalid data' note has nothing to do with producing output from a previous run.
・SAS stopped processing at the first bad record, so the output data set is complete and fully valid with no missing values present.
Incorrect. SAS does not stop at the first invalid-data record; it reads all records and the output does contain missing values where data was invalid.
・A syntax error in an INPUT statement halted execution, and the output data set contains only the observations read before the error occurred.
Incorrect. 'Invalid data' is a data-content note at execution time, not a syntax error that halts the step, and all qualifying observations are still written.
Explanation
Invalid-data notes are informational: SAS converts the unreadable value to missing, sets _ERROR_=1, and continues, so the job completes while flagging the suspect records.
Example11 · SAS Programming Fundamentals & DATA Step
During a code review at MeridianTrust Bank, a junior analyst asks what happens when the DATA step for the loan portfolio is compiled before any data is read. Which description best characterizes what SAS does in the compilation phase?
・SAS reads the first observation from the input data and writes it to the output data set after validating each column value against the program data vector.
Incorrect. Reading and writing observations happens in the execution phase, not during compilation, which processes no actual data.
✓SAS checks the syntax, builds the program data vector, and establishes attributes for each variable before any observations are processed.
Correct. Compilation checks syntax, creates the program data vector, and assigns variable attributes such as name, type, and length before execution begins.
・SAS executes the statements once for every input observation and automatically outputs each resulting record to the new portfolio data set.
Incorrect. Looping through observations and outputting records describes the execution phase, which occurs only after compilation finishes.
・SAS repeatedly initializes variables to missing, applies the logic, and writes an observation each time it loops through the entire data file.
Incorrect. Reinitializing variables to missing and writing observations in a loop are execution-phase activities, not compilation.
Explanation
Compilation is a one-time setup: SAS validates syntax, constructs the program data vector, and defines variable attributes; data is only read and written later during execution.
Example12 · SAS Programming Fundamentals & DATA Step
A programmer at Harbor Industrial Supply submits a DATA step that reads warehouse pallet weights into a numeric variable named NetWeight. The SAS log shows a note that character values were converted to numeric at the assignment statement. What does this note most likely indicate about the program?
✓A numeric variable received a character value, so SAS performed an automatic conversion and continued processing the step
Correct. SAS automatically converts a character value to numeric when it is assigned to a numeric variable, issues the conversion note, and continues running the step.
・The DATA step halted at that statement because character and numeric types can never be combined in a single assignment
Incorrect. SAS does not halt the step for this situation; it performs an automatic type conversion and writes an informational note rather than stopping.
・SAS created an entirely new character variable to store the pallet weight and discarded the numeric NetWeight variable
Incorrect. SAS does not replace the numeric variable with a new character variable; NetWeight remains numeric after the automatic conversion occurs.
・The INPUT statement incorrectly read the weight field using a date informat instead of a standard numeric informat here
Incorrect. The note describes an assignment-statement conversion, not a date informat problem, so it is unrelated to how the field was read on input.
Explanation
Automatic character-to-numeric conversion at an assignment statement produces a note in the log and lets the DATA step continue; it does not stop processing or change the variable's type.
Example13 · SAS Programming Fundamentals & DATA Step
In a DATA step that builds an inventory summary for Granite Valley Distributors, a programmer uses a RETAIN statement to accumulate a running total called TotalUnits across observations. Which outcome best describes how the RETAIN statement affects TotalUnits during execution?
✓TotalUnits holds its value from one iteration of the DATA step to the next instead of being reset to missing each time
Correct. RETAIN prevents a variable from being reset to missing at the start of each DATA step iteration, so the accumulated value carries forward.
・TotalUnits is dropped from the output data set because retained variables are always treated as temporary work values
Incorrect. A retained variable is not dropped; it remains in the output data set unless explicitly excluded with DROP or KEEP.
・TotalUnits is recalculated from scratch at each observation because RETAIN forces a reset to zero on every iteration
Incorrect. RETAIN does the opposite of resetting; it holds the prior value rather than forcing TotalUnits back to zero each iteration.
・TotalUnits automatically sums every numeric variable in the row, replacing the need for an explicit addition statement
Incorrect. RETAIN does not automatically sum variables in a row; the programmer must still write the accumulation logic that adds the new units.
Explanation
RETAIN keeps a variable's value across DATA step iterations, which is what enables manual accumulators to build a running total.
Example14 · SAS Programming Fundamentals & DATA Step
A telecom analyst at NovaCell submits a DATA step to build a subscriber table but the log shows a note that SAS went into syntax-check mode and stopped processing. The first statement reads 'DATA subscribers' with no terminating semicolon before the INPUT statement. What does the missing semicolon most likely cause SAS to do?
✓SAS treats 'subscribers' and the following keyword as one continuous statement, flags an error, and may set the SYNTAXCHECK behavior that halts later steps
Correct. Without the semicolon, SAS keeps reading tokens as part of the DATA statement, encounters an invalid combination, raises an error, and can enter syntax-check mode that suppresses subsequent steps.
・SAS automatically inserts a semicolon after the first word and continues running the DATA step without any note
Incorrect. SAS does not auto-insert semicolons; the parser continues reading until it finds one or hits an invalid token.
・SAS runs the step but writes the output to the WORK library under a different, system-generated dataset name
Incorrect. A missing semicolon does not cause SAS to rename output; it produces a parsing error instead.
・SAS ignores the DATA statement entirely and processes only the INPUT statement as a standalone step
Incorrect. SAS cannot process the INPUT statement independently because the DATA statement was never properly terminated.
Explanation
A missing semicolon makes SAS concatenate statements into one, producing a syntax error and potentially triggering syntax-check mode that stops later steps from executing.
Example15 · SAS Programming Fundamentals & DATA Step
During a code review at NovaCell, a junior programmer asks what happens in the program data vector (PDV) when a DATA step reads a raw file of call records. Which statement correctly describes how the PDV behaves across the compilation and execution phases?
✓The PDV is created during compilation to hold each variable, and during execution it is reset for every iteration except for variables named in a RETAIN statement
Correct. The PDV is established at compile time with a slot for every variable, and at execution most variables are reset to missing each iteration while RETAIN (and some automatic variables) preserve values.
・The PDV is built fresh for each observation during compilation and discarded entirely once the step has finished reading all records
Incorrect. The PDV is created once at compile time, not rebuilt for each observation, and its structure persists through execution.
・The PDV stores only the final observation of the dataset and is populated solely during the execution phase, not compilation
Incorrect. The PDV holds the current observation during processing and is created at compile time, not only during execution.
・The PDV keeps the values of all variables between iterations by default unless an explicit DROP statement clears them
Incorrect. By default values are reset to missing each iteration; RETAIN (not the absence of DROP) is what preserves values.
Explanation
The PDV is constructed during compilation and, during execution, has its variables set to missing each iteration unless RETAIN preserves them.
▶ Try 10 free questions (graded)
Measure your readiness with a full mock exam
All questions · full explanations · lifetime access
Enroll(33 USD)