SAS Certified Base Programmer 123 Questions (93)
The following SAS program is submitted:
proc sort data = sasuser.houses out = houses; by style; run; proc print data = houses; <insert statement(s) here> run;
Click on the Exhibit button to view the report produced.
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
Which of the following SAS statement(s) create(s) the report?
A.
id style;
B.
id style;
var style bedrooms baths price;
C.
id style;
var style bedrooms baths price;
D.
id style;
by style;
var style bedrooms baths price;
Topics:
SAS Base Questions |
11 Comments »
C
The answer should be:
id style;
by style;
var bedrooms baths price;
Reason:
If a variable in the ID statement also appears in the VAR statement, the output contains two columns for that variable!
D
The C should be:
id style;
by style;
var bedrooms baths price;
@2. ferrat I tested in SAS and I totally agree with you!!
I think C and D have same listing output because work.houses has been sorted.
c must be as below…..
id style;
by style;
var bedrooms baths price;
is there any obvious difference between choices B and C?
if no difference I would like to go with either or them
@6. I do not think so,because the data must be presorted by the BY variables when using By statement.
The answer B and C are exactly the same. Typo? Please correct it. Thank you.
I also tested in SAS. I agree with @2. ferrat.