Click on the Comments to view the Answers

Sunday, January 24, 2010

Base 4

The contents of the raw data file AMOUNT are listed below:


The following SAS program is submitted:

data test;
infile 'amount';
input @1 salary 6.;
Which one of the following is the value of the SALARY variable?

A. 1234
B. 1,234
C. $1,234
D. . (missing numeric value)


SASGuru said...

Answer D:
Wrong informat assigned to salary…so missing value is assigned…the informat that should be used here is comma6.

SASGURU2 said...

answer d: the format should be dollar6. because the dollar format both adds a dollar sign and inserts commas where possible

Geoff said...

Concur with both. Both of the informats listed, dollar6. and comma6., will actually work to input this data in this case. SAS help lists DOLLARw.d as an alias of COMMAw.d. I think they kept both informats because this makes it easier to use the formats COMMAw.d and DOLLARw.d, which affect how the data is displayed. Here DOLLARw.d formatting will add a $ to the front, while COMMAw.d will not. Here is the SAS help definition of what the COMMAw.d informat does.

The COMMAw.d informat reads numeric values and removes embedded commas, blanks, dollar signs, percent signs, hyphens, and close parentheses from the input data. The COMMAw.d informat converts an open parenthesis at the beginning of a field to a minus sign.

Bijaya Gaire said...
This comment has been removed by the author.
Bijaya Gaire said...

Answer: D
Existing code produces 'NOTE: Invalid data for salary' in sas log so, missing numeric value in output.
Informat comma6. will give 1234
Informat Comma6. and format comma6. will give 1,234
and Informat comma6. and format dollar6. will give $1,234

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