Exam A00-211 All QuestionsBrowse all questions from this exam
Question 12

Given the SAS data set PRICES:

Prodid price producttype sales returns

K125 5.10 NETWORK 15 2

B132S 2.34 HARDWARE 300 10

R18KY2 1.29 SOFTWARE 25 5

3KL8BY 6.37 HARDWARE 125 15

DY65DW 5.60 HARDWARE 45 5

DGTY23 4.55 HARDWARE 67 2

The following SAS program is submitted:

data hware inter cheap;

set prices(keep = productype price);

if producttype = HARDWARE then output hware; else if producttype = NETWORK then output inter; if price le 5.00; run; if producttype = HARDWARE then output hware; else if producttype = NETWORK then output inter; if price le 5.00; run;

How many observations does the HWARE data set contain?

    Correct Answer: A

    The SAS data step processes each record and the 'if' conditions filter the records before they are outputted. The program given keeps only the 'producttype' and 'price' variables. It then checks if the 'producttype' is 'HARDWARE' and outputs it to 'hware,' and if 'producttype' is 'NETWORK' it outputs to 'inter.' However, the condition 'if price le 5.00' is after the output statements, meaning it has no effect on the output since only 'price' <= 5.00 records are filtered after attempting to output the records. Hence, 'hware' data set will contain 0 observations because none of the 'HARDWARE' records are outputted since the price condition is not met during the filtering in the specified sequence.

Discussion
mhminkovOption: D

given answer D is correct, as the statement "if price le 5.00;" is located after the output statement (Q15 has the same statement located before the output statement).

Kleinstone

see question 15