SAS Certified Professional: Advanced Programming Using SAS 9.4 Free Sample Questions

20 free sample questions326 in the full practice test

Try simulator

A00-232 Sample Questions

  1. Question 1

    A financial services company needs to generate a report of all customer transactions from the work.transactions dataset. For each transaction, the report must include the customer's current city from the work.demographics dataset. The final report must include all transactions, even if a customer's demographic record is missing. If a customer's city is missing, the report should display 'Unknown'. Which PROC SQL query correctly fulfills this requirement?

    Answer and explanation

    Correct answer: B

    This is the correct solution. A LEFT JOIN is required to ensure all records from the work.transactions table are included, regardless of a match in work.demographics. The COALESCE function is then used to replace any resulting null values in the city column with the string 'Unknown', meeting all requirements.

  2. Question 2

    A developer is creating a data-driven macro to generate summary reports for a list of products. The product IDs are stored in a dataset WORK.PRODUCT_LIST. The macro needs to create a series of macro variables, one for each product ID, named prod1, prod2, prod3, etc. Which code snippet correctly populates these indexed macro variables?

    Answer and explanation

    Correct answer: B

    This is the correct method. In a DATA step, the automatic variable _N_ represents the current iteration number. By concatenating the string 'prod' with the value of _N_, we can dynamically create macro variable names like prod1, prod2, etc. CALL SYMPUTX is the appropriate routine for assigning values to macro variables from a DATA step.

  3. Question 3

    A programmer needs to combine a very large transaction dataset (WORK.TRANSACTIONS, 50 million rows) with a small product lookup table (WORK.PRODUCTS, 2,000 rows) to add the ProductName to the transaction data. The WORK.TRANSACTIONS dataset is not sorted by ProductID. What is the most computationally efficient method to perform this lookup, minimizing both CPU time and I/O operations?

    Answer and explanation

    Correct answer: C

    This is the most efficient method. Loading the small lookup table into a hash object in memory avoids the massive I/O overhead of sorting the 50-million-row transaction table. The in-memory hash lookup is extremely fast, making this the best choice for performance when joining a large table to a small one, especially when the large table is unsorted.

  4. Question 4

    You are debugging a complex SAS macro that dynamically generates SQL code. You suspect that a macro variable is not resolving to the expected value, causing the SQL query to fail. You need to see the exact value of the macro variable as it is being resolved by the macro processor. Which system option is specifically designed for this purpose?

    flowchart TD Start[Macro Call] --> MacroProcessor{Macro Processor} MacroProcessor -->|Resolves &myvar| SymbolGenLog[SYMBOLGEN writes: &myvar resolves to 'Value'] MacroProcessor -->|Generates Code| MPrintLog[MPRINT writes: proc sql... where col = 'Value'] SymbolGenLog --> MPrintLog MPrintLog --> Execution

    Answer and explanation

    Correct answer: C

    The SYMBOLGEN system option is specifically designed to write the results of macro variable resolution to the SAS log. It is the most direct way to see what value a macro variable reference (like &myvar) resolves to during macro execution, making it essential for debugging issues related to incorrect variable values.

  5. Question 5

    A marketing analyst needs to find all customer comments in the SURVEY.RESPONSES table that contain either the word 'service' or 'support', but not when these words are part of a larger word (e.g., 'serviced' should not match). The search must be case-insensitive. Which WHERE clause correctly implements this logic using PRX functions?

    Answer and explanation

    Correct answer: C

    This is the correct solution. The \b is a regular expression metacharacter for a word boundary. Placing it before and after the grouped terms (service|support) ensures that the match occurs only for the whole words. The /i modifier at the end makes the pattern matching case-insensitive. PRXMATCH returns true if the pattern is found.

  6. Question 6

    Multiple answers

    A data analyst is tasked with creating a summary report from a SALES table. The report needs to show the total revenue for each product category, but only for categories that have generated more than $1,000,000 in total revenue. Which two clauses must be used in the PROC SQL step to achieve this? (Select TWO).

    Answer and explanation

    Correct answers: B, D

    The GROUP BY clause is necessary to aggregate the sales data by product_category so that the SUM() function can calculate the total revenue for each category.

    The HAVING clause is used to filter the results of a query based on the values of aggregate functions. Since the requirement is to filter categories based on their total revenue (SUM(revenue) > 1000000), HAVING is the correct clause to use after the GROUP BY.

  7. Question 7

    A SAS programmer has written the following macro. The intent is to pass a numeric value and have the macro evaluate if it is greater than 100.

    %macro check_value(val);
    %let result = %eval(&val > 100);
    %put The result is &result;
    %mend;

    The programmer then calls the macro with a non-integer value: %check_value(val=105.5).

    What is the outcome of this macro call?

    Answer and explanation

    Correct answer: C

    The %EVAL function is designed for integer arithmetic only. When it encounters a floating-point number like 105.5, it cannot perform the evaluation and will generate an error in the SAS log stating that the operand was invalid. To handle floating-point numbers in macro expressions, the %SYSEVALF function must be used instead.

  8. Question 8

    To create a user-defined function that can be used in a DATA step or a WHERE clause, you must use PROC FCMP. True or False?

    Answer and explanation

    Correct answer: A

    True. The PROC FCMP (Function Compiler) procedure is the standard SAS utility for creating, storing, and managing custom, reusable functions and subroutines. Once compiled and stored, these functions can be invoked from various SAS steps, including DATA steps and WHERE clauses, provided the CMPLIB= system option is set correctly.

  9. Question 9

    A research institute is analyzing longitudinal patient data stored in WORK.VISITS, sorted by PatientID and VisitDate. For each visit, the analyst needs to calculate the number of days since that patient's previous visit. If it is the patient's first visit, the result should be a missing value. Which code snippet correctly computes this difference?

    Answer and explanation

    Correct answer: A

    This is a correct and idiomatic SAS solution. The DIF function calculates the difference between the current value of a variable and its previous value. When used with BY group processing, it automatically resets to missing for the first observation of each BY group (first.PatientID), perfectly handling the requirement to have a missing value for the first visit of each patient.

  10. Question 10

    A programmer needs to query the SAS DICTIONARY.TABLES view to get a list of all datasets in the WORK library. However, they want to limit the result to the first 5 tables found and prevent the results from printing to the output window. Which PROC SQL statement correctly achieves this?

    Answer and explanation

    Correct answer: B

    This is the correct solution. The NOPRINT option on the PROC SQL statement suppresses the default behavior of printing results to the output window. The OUTOBS=5 option limits the number of rows written to any output tables (or displayed, if not for NOPRINT) to 5. These are invocation options that control the procedure's overall behavior.

Register free to unlock 10 more sample questions

Lifetime One

Own this practice test forever.

$79.99
$75.99
one-time
  • Full access to 326 questions
  • Study, Timed & Flashcard Modes
  • All past and future versions i
  • Detailed Explanations
  • Study Tracking & Past Attempts
  • Brainy AI Assistant
  • Lifetime updates

Two

Any 2 exams per month.

$20.00/exam
$39.99
/month
  • 2 active exam slots
  • Study, Timed & Flashcard Modes
  • All past and future versions i
  • Detailed Explanations
  • Study Tracking & Past Attempts
  • 1,000 Brainy AI Credits
  • Cancel anytime

Premium Twelve

Any 12 exams over 3 months.

$15.00/exam
$179.99
/3 months
  • 4 active exam slots
  • Study, Timed & Flashcard Modes
  • All past and future versions i
  • Detailed Explanations
  • Study Tracking & Past Attempts
  • 15,000 Brainy AI Credits
  • Dedicated support
  • Friend seat included — full access

Trusted by professionals at

NvidiaSupabaseGitHubOpenAITursoClerkClaude AIAmazon