Click on the Comments to view the Answers

Monday, January 25, 2010

Base 38

When the following SAS program is submitted, the data set SASDATA.PRDSALES contains 5000 observations:

libname sasdata 'SAS-data-library';
options obs = 500;


proc print data = sasdata.prdsales (firstobs = 100);
run;


options obs = max;
proc means data = sasdata.prdsales (firstobs = 500);
run;


How many observations are processed by each procedure?
A. 400 for PROC PRINT 4500 for PROC MEANS
B. 401 for PROC PRINT 4501 for PROC MEANS
C. 401 for PROC PRINT 4500 for PROC MEANS
D. 500 for PROC PRINT 5000 for PROC MEANS

17 comments:

SASGuru said...

Answer: A
400 for PROC PRINT 4500 for PROC MEANS

Unknown said...

AnsB I supose. Please have a look!

Unknown said...

i agree wid sandeep

pal said...

yaa its ans is B

V.V. said...

Ans = B.

It is Last_observation - First_observation+1;
Hence answer is 500-100+1 = 401; and 5000-500+1 =4501;

sarabjeet's recommended hardware said...

but why it is so.What is the reason for this VV.
please mail me the reason on sarabjeetrana@gmail.com

siva said...

Answer B

SASGURU2 said...

B...B...I'll take B all day...

Geoff said...

The reason is that it will go from firstobs to obs, inclusive. So it will count 100, 101, 102, ... 499, and 500. Just one of those funny math things you've got to watch out for.

shalini said...

yes the answer is B

Unknown said...

It is B
data data;
counter=1;
do counter = 1 to 5000;
output;
end;
run;

options obs = 500;

proc print data = data (firstobs = 100);
run;

options obs = max;
proc means data = data (firstobs = 500);
run;

Amit Rathore said...

Answer is B.

Proc Print - 100th Observation + remaining 400 observations= 401;
Proc mean - 500th Observation + remaining 4500 observations = 4501;

Unknown said...

Ans is B

Nitin Paighowal said...

Answer is B as Lastob - firstOb +1

Dutchy said...

The formula is: OBS - Firstobs + 1
NB: If there is a where clause, then you must perform this formula on the result of the output of the where!!!!!!
E.g., if you have a file of 1 million records, and after the where, 10 records left. then the total population is 10. If obs-firstobs+1 results in number of records > 10, then you will have only 10 records!

Unknown said...
This comment has been removed by the author.
Unknown said...

yes, the answer is B, 401 obs read from proc print, 4501 obs from proc means.

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