Click on the Comments to view the Answers

Wednesday, January 27, 2010

Q2

The SASDATA.BANKS data set has five observations when the following SAS program is submitted:

libname sasdata 'SAS-data-library';

data allobs;
set sasdata.banks;
capital=0;
do year = 2000 to 2020 by 5;
capital + ((capital+2000) * rate);
output;
end;
run;

How many observations will the ALLOBS data set contain?

A. 5
B. 15
C. 20
D. 25

8 comments:

SASGuru said...

Answer D

Banks has 5 obs and then the do loop outputs for (20/5 + 1) times. Therefore 5*(20/5 + 1) is the observation count

Rujuta........ said...

D. 25

Unknown said...

CAn you pls explain SASGuru why is it not 5+5=10?

siva said...

Answer D
per rate its caleculated 5 times.
data banks;
input rate;
datalines;
2
4
8
9
10
;
run;

data allobs;
set banks;
capital=0;
do year = 2000 to 2020 by 5;
capital + ((capital+2000) * rate);
output;
end;
run;

smita said...

This is the output what you get after running

Obs rate capital year
1 2 4000 2000
2 2 16000 2005
3 2 52000 2010
4 2 160000 2015
5 2 484000 2020
6 4 8000 2000
7 4 48000 2005
8 4 248000 2010
9 4 1248000 2015
10 4 6248000 2020
11 8 16000 2000
12 8 160000 2005
13 8 1456000 2010
14 8 13120000 2015
15 8 118096000 2020
16 9 18000 2000
17 9 198000 2005
18 9 1998000 2010
19 9 19998000 2015
20 9 199998000 2020
21 10 20000 2000
22 10 240000 2005
23 10 2660000 2010
24 10 29280000 2015
25 10 322100000 2020

Ryan Lo said...

Answer is D.

SASDATA.BANKS has 5 obs and then the DO loop outputs for 5 (2000, 2005, 2010, 2015, 2020) times. Therefore 5 * 5 = 25 observations output to the ALLOBS.

Unknown said...

D

Unknown said...

25

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