Click on the Comments to view the Answers

Sunday, January 24, 2010

Base 8

The following SAS program is submitted:


data work.totalsales;
set work.monthlysales(keep = year product sales);
retain monthsales {12} ;
array monthsales {12} ;
do i = 1 to 12;
        monthsales{i} = sales;
end;
cnt + 1;
monthsales{cnt} = sales;
run;


The data set named WORK.MONTHLYSALES has one observation per month for each of five years for a total of 60 observations.

Which one of the following is the result of the above program?


A. The program fails execution due to data errors.
B. The program fails execution due to syntax errors.
C. The program runs with warnings and creates the WORK.TOTALSALES data set with 60 observations.
D. The program runs without errors or warnings and creates the WORK.TOTALSALES data set with 60 observations.

1 comment:

SASGuru said...

Answer B
The retain statement with the array was defined earlier than the array definition itself. And also the retain statement should be defined as retain monthsales1-monthsales12;


data work.totalsales;
infile cards;
input year product $ sales;
array monthsales {12} ;
retain monthsales1-monthsales12;

do i = 1 to 12;
monthsales{i} = sales;
end;
cnt + 1;
monthsales{cnt} = sales;
cards;
2000 A 10
2010 B 20
;
run;

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