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

## 18 comments:

Answer: A

400 for PROC PRINT 4500 for PROC MEANS

AnsB I supose. Please have a look!

i agree wid sandeep

yaa its ans is B

Ans = B.

It is Last_observation - First_observation+1;

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

but why it is so.What is the reason for this VV.

please mail me the reason on sarabjeetrana@gmail.com

Answer B

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

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.

yes the answer is B

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;

Answer is B.

Proc Print - 100th Observation + remaining 400 observations= 401;

Proc mean - 500th Observation + remaining 4500 observations = 4501;

B

Ans is B

Answer is B as Lastob - firstOb +1

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!

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

## Post a Comment