01. During DATA step execution, SAS automatically sets the automatic variable _ERROR_ to 1 for the current observation under certain conditions.
Which of the following, occurring while a DATA step is executing, set _ERROR_ to 1 for the observation being processed?
(Choose two.)
a) A misspelled statement keyword prevents the DATA step from compiling at all.
b) SAS logs a routine NOTE reporting how many observations were read from the input data set.
c) Invalid character data is encountered while an INPUT statement tries to read it into a numeric variable.
d) An automatic character-to-numeric conversion completes successfully for a value in the current observation.
e) An arithmetic expression attempts to divide by zero for the current observation.
02. The SAS log reports three general categories of messages while a program runs. Which category indicates a condition that did not prevent the step from completing, but flags something the programmer should probably investigate — as opposed to a purely routine status message?
a) WARNING
b) ERROR
c) NOTE
d) None of these — SAS does not distinguish between message severities.
03. A print shop wants a report of only its urgent orders from a larger order queue:
proc print data=work.orders; where rushorder = 'Y'; var orderid customer duedate; run;
What does the WHERE statement do in this PROC PRINT step?
a) It prints all orders but sorts rush orders to appear at the top of the report.
b) It permanently deletes every non-rush order from the work.orders data set once the step completes.
c) It creates a new variable named rushorder in the report if one does not already exist in the data set.
d) It restricts the report to rows where rushorder equals 'Y', without altering work.orders itself.
04. A coffee shop's raw sales extract stores the column unit_price as character data (for example, the text value "3.50") because it was imported from a point-of-sale export. A programmer submits the following DATA step:
data work.receipts;
set work.posraw;
total_due = qty * unit_price;
run;
The SAS log shows: NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column). No ERROR or WARNING appears anywhere else in the log.
What does this NOTE mean for the DATA step?
a) SAS silently dropped qty from the calculation and substituted a missing value.
b) SAS converted unit_price to numeric automatically and completed the calculation; the NOTE is only informational.
c) The DATA step failed to compile, so work.receipts was never created.
d) SAS renamed unit_price to a brand-new temporary numeric variable, leaving the original character column completely unused in the calculation.
05. work.quarterly has variables q1_sales q2_sales q3_sales q4_sales. A programmer wants to increase every quarter's value by 3% in place, using an array rather than four separate assignment statements. Which code correctly does this?
a) array qsales{4} q1_sales q2_sales q3_sales q4_sales; do i = 1 to 4; qsales{i} = qsales{i} * 1.03; end;
b) array qsales{4} q1_sales q2_sales q3_sales q4_sales; qsales = qsales * 1.03;
c) array qsales{4} q1_sales q2_sales q3_sales q4_sales; do i = 1 to 4; qsales = qsales{i} * 1.03; end;
d) array qsales{4} q1_sales q2_sales q3_sales q4_sales; do i = 1 to 3; qsales{i} = qsales{i} * 1.03; end;
06. An HR DATA step computes each employee's tenure:
data hr.staff; set hr.staff_raw; tenure_days = today() - hire_date; run;
What does the expression today() - hire_date calculate for each employee?
a) The number of business days only, excluding weekends and holidays entirely, counted between hire_date and today's date.
b) The employee's precise age expressed in whole years, calculated directly as of today's current date.
c) A brand-new SAS date value representing hire_date shifted forward by the current date's day-of-month component only.
d) The number of days between hire_date and today, since subtracting two SAS date values yields a plain day count.
07. A farm-management DATA step computes yield per acre:
data farm.yield_summary; set farm.yield_raw; yield_per_acre = total_yield / acres; run;
Some observations have a missing value for acres. What happens for those observations, and what appears in the log?
a) SAS automatically drops any observation with a missing value for acres from the final output data set, without logging any message at all.
b) SAS treats the missing acres value as though it equaled 1, allowing the division to complete without producing any missing result.
c) SAS computes yield_per_acre as missing for that observation, logs a 'Missing values were generated' NOTE, and keeps processing the rest.
d) The DATA step terminates immediately upon encountering the first observation with a missing acres value, aborting the entire run.
08. Several SAS character functions can be used while searching text, but they don't all return the same kind of result.
Which of the following functions return the numeric starting position of a substring within a longer string, rather than returning the substring's text itself?
(Choose two.)
a) INDEX
b) SCAN
c) FIND
d) TRANWRD
e) SUBSTR
09. A hotel wants to see how room bookings break down by room type and season:
proc freq data=work.bookings; tables roomtype*season; run;
Which of the following statements about this default two-way TABLES output are true?
(Choose two.)
a) A chi-square test of association between roomtype and season is automatically calculated and printed with no additional option requested.
b) Listing roomtype*season builds a separate one-way table for each distinct roomtype value instead of a single combined two-way table.
c) Observations with a missing roomtype or season value are excluded from the table by default, unless the MISSING option is added.
d) The default cell shows the frequency count plus row, column, and overall percentages for each combination.
e) The TABLES statement automatically arranges roomtype and season into descending frequency order before building the crosstab.
10. Two regional customer data sets are concatenated:
data combined.customers; set region_east.customers region_west.customers; run;
The log reports ERROR: Variable customer_id has been defined as both character and numeric. What causes this, and what must be done to fix it?
a) The two source data sets store customer_id with different types (character vs numeric); one must be converted before combining them with SET.
b) The BY statement is missing from the SET statement, so SAS has no way to align observations between the two data sets correctly.
c) The two data sets simply have a different number of observations, which SAS reports here as an underlying type conflict error.
d) One of the two source data sets is missing the customer_id variable entirely, so SAS cannot reconcile or align any of its attributes between the two inputs.