Click on the Comments to view the Answers

Tuesday, January 19, 2010

INFILE statement

A raw data file is listed below.


Jose,47,210
Sue,,108


The following SAS program is submitted using the raw data file above as input:

data employeestats;

input name $ age weight;
run;


Which of the following INFILE statements completes the program and accesses the data
correctly?
a. infile 'file-specification' pad;
b. infile 'file-specification' dsd;
c. infile 'file-specification' dlm=',';
d. infile 'file-specification' missover;



The following output is desired:

name age weight
Jose   47  210
Sue     .    108

Check the comments below for answers....

4 comments:

SASGuru said...

Answer; b

The PAD option specifies that SAS pad variable length records with blanks. The MISSOVER
option prevents SAS from reading past the end of the line when reading free formatted data. The
DLM= option specifies the comma as the delimiter; however, consecutive delimiters are treated as
one by default. The DSD option correctly reads the data with commas as delimiters and two
consecutive commas indicating a missing value like those in this raw data file.

Anonymous said...

infile 'file-specification' missover;
missover
prevents an INPUT statement from reading a new input data record if it does not find values in the current input line for all the variables in the statement. When an INPUT statement reaches the end of the current input data record, variables without any values assigned are set to missing.

H. C. said...

b

Matt said...

B

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