The following SAS program is submitted:
proc sort data = sasuser.houses out = houses;
by style;
run;
proc print data = houses;
.
run;
by style;
run;
proc print data = houses;
run;
style bedrooms baths price
CONDO 2 1.5 80050
3 2.5 79350
4 2.5 127150
2 2.0 110700
RANCH 2 1.0 64000
3 3.0 86650
3 1.0 89100
1 1.0 34550
SPLIT 1 1.0 65850
4 3.0 94450
3 1.5 73650
TWOSTORY 4 3.0 107250
2 1.0 55850
2 1.0 69250
4 2.5 102950
3 2.5 79350
4 2.5 127150
2 2.0 110700
RANCH 2 1.0 64000
3 3.0 86650
3 1.0 89100
1 1.0 34550
SPLIT 1 1.0 65850
4 3.0 94450
3 1.5 73650
TWOSTORY 4 3.0 107250
2 1.0 55850
2 1.0 69250
4 2.5 102950
Which of the following SAS statement(s) create(s) the report?
A. id style;
A. id style;
B. id style; var style bedrooms baths price;
C. id style; by style; var bedrooms baths price;
D. id style; by style; var style bedrooms baths price;
3 comments:
Answer : C
data test;
infile cards;
input style $ bedrooms baths price;
cards;
CONDO 2 1.5 80050
CONDO 3 2.5 79350
RANCH 2 1.0 64000
RANCH 3 3.0 86650
;
run;
proc print data=test;
id style;
by style;
var bedrooms baths price;
run;
Yes. it is C
A is not correct because ID statement removes only the obs column and you need BY and VAR statements to get the desired output.
B is wrong. Without BY statement the sort procedure could not be performed
D is also wrong because variable, STYLE was used in both ID and VAR statement which will result two columns of variable, STYLE.
You can also use a proc print without BY, but only the combination ID and BY will suppress the repeating style in the first columnu
So C
Post a Comment