A00-231 Sample Questions

A00-231 Sample Questions & Answers

Manipulating and managing SAS data takes well over a third of the weight, including date values and sorting, next to creating data sets and reaching outside libraries, spotting and resolving coding mistakes, and producing list and summary reports.

Launch the full A00-231 simulator →

Showing 10 of 20 free samples.

  1. Question 1Advanced

    Generate Reports and Output · Generate Output with ODS

    A reporting analyst at a retail company needs to generate a weekly sales report. The requirements are as follows:

    1. The final report must be an Excel file named weekly_sales.xlsx for business users.
    2. A PDF version named archive_sales.pdf must be created for archival purposes.
    3. The report should contain summary statistics from PROC MEANS and frequency tables from PROC FREQ.
    4. However, the archived PDF should NOT contain the detailed frequency tables from PROC FREQ to save space.

    Which ODS code block correctly fulfills all these requirements?

    Show answer & explanation

    Correct answer: D

    This is the correct solution. It opens both ODS destinations (EXCEL and PDF) at the beginning. It then uses ods pdf exclude Freq; to specifically tell the PDF destination to ignore any output from PROC FREQ. The EXCEL destination is not affected and will receive output from both procedures. Finally, ods _all_ close; is the best practice to close all open destinations. This approach is targeted and correctly implements the specific exclusion requirement for only one of the destinations.

  2. Question 2Advanced

    Manage Data · Restructure Data with PROC TRANSPOSE

    A dataset named PATIENT_METRICS is in a 'wide' format, with one row per patient and separate columns for measurements taken on different dates (Weight_Day1, Weight_Day7, Weight_Day30). To perform a time-series analysis, the data needs to be restructured into a 'long' format with columns PatientID, Day, and Weight. Which PROC TRANSPOSE step correctly performs this transformation?

    Show answer & explanation

    Correct answer: C

    This is the most efficient and correct solution. The BY PatientID; statement ensures each patient's data is processed as a group and PatientID is retained in the output. The VAR Weight_:; statement uses a variable list to select all variables starting with 'Weight_', which is a flexible way to include all measurement columns. By default, PROC TRANSPOSE will create a _NAME_ variable with the original variable names (Weight_Day1, etc.) and a COL1 variable with their values. The RENAME= option is then used to give these new columns more meaningful names. Subsequent data steps would be needed to parse the day number from the Measurement variable.

  3. Question 3Intermediate

    Access and Create Data Structures · Investigate SAS Data Libraries

    You need to assign a permanent library reference named PROJECT1 to a directory located at /user/data/project1. The data in this directory is a mix of SAS datasets and Microsoft Excel files. You want to use the XLSX engine to directly read the Excel files. Which LIBNAME statement is syntactically correct for this purpose?

    Show answer & explanation

    Correct answer: B

    The correct syntax for a LIBNAME statement is LIBNAME libref [engine] 'path' [options];. The engine name, XLSX in this case, is specified directly after the libref and before the path. The ENGINE= keyword is not used in this context.

  4. Question 4Beginner

    Manage Data · Conditionally Execute Statements

    A developer is writing a program to categorize customers into one of four distinct, non-overlapping tiers based on their TotalSpending. Which conditional logic structure is generally more efficient and readable for this task compared to a series of IF-THEN/ELSE IF statements?

    Show answer & explanation

    Correct answer: C

    For evaluating a single variable against multiple mutually exclusive conditions, a SELECT group is often more efficient and easier to read than a long chain of IF-THEN/ELSE IF statements. The SELECT statement evaluates the expression once and then compares the result to each WHEN condition, which can be faster than re-evaluating conditions in an IF chain.

  5. Question 5Intermediate

    Generate Reports and Output · Enhance Reports with PROC FORMAT

    A hospital administrator wants to create a report that groups patient satisfaction scores (Score, ranging 1-100) into descriptive categories: 'Poor' (1-40), 'Average' (41-70), 'Good' (71-90), and 'Excellent' (91-100). Any other score should be labeled 'Invalid'. Which PROC FORMAT code correctly defines this custom format?

    Show answer & explanation

    Correct answer: A

    This code is correct. The VALUE statement defines a format named ScoreFmt. It correctly specifies numeric ranges for each category. The keyword OTHER is used as a catch-all for any values that do not fall into the specified ranges, which is the proper way to handle unexpected or invalid data.

  6. Question 6AdvancedSelect 2

    Manage Data · Use Macro Variables

    A programmer is developing a reusable program that processes monthly data. The input dataset name changes each month (e.g., data_jan, data_feb). To make the program flexible, the programmer wants to use a macro variable &Month to specify the dataset name. Which statements correctly create a macro variable from a DATA step variable and then use it in a subsequent DATA step? (Select TWO)

    Show answer & explanation

    Correct answers: A, C

    CALL SYMPUTX is the recommended routine for creating a macro variable from a DATA step variable's value. It automatically handles data type conversions and trims leading/trailing blanks, making it more robust than CALL SYMPUT.

    To reference the value of a macro variable, you use an ampersand (&) followed by the variable name. The macro processor will resolve &Month to its current value (e.g., 'jan') before the SAS compiler executes the statement, resulting in set data_jan;.

  7. Question 7Intermediate

    Error Handling · Identify and Resolve Programming Logic Errors

    A program designed to calculate compound interest runs without any syntax errors. However, the final interest amount is always equal to the interest from the very last period, not the accumulated total. The programmer suspects a logic error in the DO loop. Review the code below:

    data WORK.COMPOUND;
    Principal = 1000;
    Rate = 0.05;
    do Year = 1 to 10;
    Interest = Principal * Rate;
    Principal = Principal + Interest;
    end;
    run;
    

    What is the primary logic error causing the incorrect final Principal value in the output dataset?

    Show answer & explanation

    Correct answer: C

    The DATA step reads data and then has an implicit OUTPUT at the end. In this case, there is no input dataset, so the DATA step executes its code once. The DO loop iterates 10 times, correctly updating the Principal variable in memory. However, because there is no explicit OUTPUT statement inside the loop, SAS only writes to the output dataset once, at the very end of the DATA step. At that point, Principal holds its final calculated value, and only a single observation is created.

  8. Question 8Advanced

    Access and Create Data Structures · Combine SAS Data Sets

    A clinical research organization is consolidating patient data from three sources:

    • DEMO: Contains PatientID and demographic variables (e.g., Age, Gender). This is the master list of all patients.
    • VISITS: Contains PatientID, VisitDate, and VisitType. A patient can have multiple visits.
    • LABS: Contains PatientID, TestDate, and Result. A patient may not have lab results for every visit.

    The goal is to create a final dataset, ANALYSIS, that contains one row for each visit a patient had, including their demographic information and any lab results that match the PatientID. Which sequence of steps is the most robust and accurate method to achieve this?

    flowchart TD A[DEMO Data] --> C{Sort DEMO} B[VISITS Data] --> D{Sort VISITS} C & D --> E(Merge DEMO and VISITS) F[LABS Data] --> G{Sort LABS} E & G --> H(Merge with LABS) H --> I[Final ANALYSIS Dataset]
    Show answer & explanation

    Correct answer: C

    This is the correct and most robust approach. The first merge is a one-to-many merge, combining the single-record-per-patient DEMO data with the multiple-records-per-patient VISITS data. This correctly propagates demographic information to each visit record. The second merge then adds the lab results. This two-step process correctly handles the different granularities (one-to-many relationships) of the source tables. Sorting before each merge is critical.

  9. Question 9Intermediate

    Manage Data · Use SAS Functions (Conversion)

    A dataset contains a character variable LoanDate_char with values like '2024-03-15'. To perform date calculations, it must be converted to a numeric SAS date variable named LoanDate_num. Which assignment statement correctly performs this conversion?

    Show answer & explanation

    Correct answer: B

    The INPUT() function is used to convert character values to numeric values. The first argument is the source character variable (LoanDate_char), and the second argument is the informat that describes the structure of the character string. The yymmdd10. informat correctly reads a date in the 'YYYY-MM-DD' format.

  10. Question 10Beginner

    Generate Reports and Output · Generate List Reports with PROC PRINT

    A project manager wants a simple report from the WORK.TASKS dataset, which contains ProjectID, TaskName, and HoursSpent. The report must list all tasks for each project and provide a total of HoursSpent for each project. Which PROC PRINT code will generate this report?

    Show answer & explanation

    Correct answer: B

    This is the correct syntax. The BY ProjectID; statement groups the report by project (assuming the data is already sorted by ProjectID). The SUM HoursSpent; statement instructs PROC PRINT to calculate and display a sum for the HoursSpent variable at the end of each BY group.

Ready for the real thing?

The full A00-231 simulator has every exam-style question, timed mode, and instant scoring.