Given the SAS data set PRICES:
PRICES
Prodid priceproducttypesalesreturns
K1255.10NETWORK152
B132S 2.34HARDWARE30010
R18KY2 1.29SOFTWARE255
3KL8BY 6.37HARDWARE12515
DY65DW 5.60HARDWARE455
DGTY23 4.55HARDWARE672
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;
How many observations does the HWARE data set contain?
Ans is 4.
I know there are 4 obs with Hardware, but will the "if price le 5.00" affects the answer? causing only those hardware with price le 5.00 get selected and change the answer to 2 observations. Please help, thanks!!!
You put the IF PRICE aafter the OUTPUT statement, therefor it will not affect the results and you get 4 obs.
If you change the code so that IF PRICE preceeds the OUTPUT statement it will affect it.
You put the IF PRICE aafter the OUTPUT statement, therefor it will not affect the results and you get 4 obs.
If you change the code so that IF PRICE preceeds the OUTPUT statement it will affect it.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: