Click on the Comments to view the Answers

Sunday, January 24, 2010

Base 27

The following SAS program is submitted:


proc sort data = sasuser.houses out = houses;
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


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; by style; var bedrooms baths price;
D. id style; by style; var style bedrooms baths price;

3 comments:

SASGuru said...

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;

Unknown said...

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.

Dutchy said...

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



Technology Top Blogs On our way to 1,000,000 rss feeds - millionrss.com Hihera.com Blog Directory - OnToplist.com blogarama - the blog directory Blog Directory
Disclaimer

SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.

Other brand and product names are trademarks of their respective companies.

This blog is not responsible for any kind of copyright violation. This blog just collects the links hosted or posted by other servers/people/search engines.The creator of this page or the ISP(s) hosting any content on this site take no responsibility for the way you use the information provided on this site.If anybody has any copyright claim on it and doesn’t wish the information provided to be shown on our site, please do respond to this email. We shall remove them off immediately. Any inconvenience is regretted. Please do mention your exact grievance/problems with respect to certain third party links. We assure you that appropriate action will be taken off. Thank you