Click on the Comments to view the Answers

Wednesday, January 27, 2010

Q18

The following SAS program is submitted:

data work.flights;
destination = 'CPH';
select(destination);
when('LHR') city = 'London';
when('CPH') city = 'Copenhagen';
otherwise;
end;
run;

Which one of the following is the value of the CITY variable?

A. London
B. Copenh
C. Copenhagen
D. ' ' (missing character value)

7 comments:

SASGuru said...

Answer: B

When SAS sees the DESTINATION for the first time i.e. ‘London’ it sets the length to 6 characters…Therefore the value ‘Copenh’ is assigned to DESTINATION becoz of the length.

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

B. Copenh

Ryan Lo said...

Answer is B.

Please see SASGuru's comment.

kinnari said...

Answer is B copenh

Unknown said...

B

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

I think Memory is allocated for variables before the data steps are executed. During this pass sas looks for the statements that first initialize the variables. At this time memory is allocated depending on the length of the value being assigned to it. Later this memory length does not change for character variables. Additional memory is not allocated to the variable as the length of character variable increases. there is no dynamic memory allocation.

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