SAS Base Programming for SAS 9 — Question 13

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?

Answer options

Correct answer: D

Explanation

The HWARE data set contains 4 observations because the SAS program filters for products of type HARDWARE and checks their price. The qualifying products with prices less than or equal to 5.00 are B132S, 3KL8BY, DY65DW, and DGTY23, all of which meet the criteria, resulting in 4 observations. The other options do not account for all qualifying observations.