Click on the Comments to view the Answers

Sunday, January 24, 2010

Base 36

A raw data record is listed below: 

Printing    750

The following SAS program is submitted:

data bonus;
infile 'file-specification';
input dept $ 1 - 11 number 13 - 15;

Which one of the following SAS statements completes the program and results in a value of 'Printing750' for the DEPARTMENT
A. department = trim(dept) number;
B. department = dept input(number,3.);
C. department = trim(dept) || put(number,3.);
D. department = input(dept,11.) || input(number,3.);


SASGuru said...

Answer C

You would need trim to remove trailing blanks for dept and put() for converting numeric 750 to character

Patrick said...


Dutchy said...

You may do it without the put, you will have no syntax error. However, if you concatenate a numeric value, that values is converted to a best 12 format, resulting in heading spaces. So result will then be "printing 123". Only if you use a put, it will result in printing123

data flowers1;
input dept $ 1-11 number 13-15;
department = trim(dept) || number;
Printing 123

Post a Comment

Technology Top Blogs On our way to 1,000,000 rss feeds - Blog Directory - blogarama - the blog directory Blog Directory

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