Click on the Comments to view the Answers

Wednesday, January 27, 2010

Q3

A raw data file is listed below:

--------10-------20-------30
John McCloskey 35 71
June Rosesette 10 43
Tineke Jones 9 37

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

data work.homework;
infile 'file-specification';
input name $ age height;
if age LE 10;
run;

How many observations will the WORK.HOMEWORK data set contain?
A. 0
B. 2
C. 3
D. No data set is created as the program fails to execute due to errors.

15 comments:

SASGuru said...

Answer: C
This is a tricky question…
The values for name have embedded blanks and also no length statement…so the values assigned for age is . (missing) for all obs. And also . (missing) is always le 10. Therefore the output dataset has 3 obs.
data banks;
input name $ age height;
if age LE 10;
cards;
John McCloskey 35 71
June Rosesette 10 43
Tineke Jones 9 37
;
run;

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

C. 3

V.V. said...

To get the correct answer

data new;
infile datalines;
input name & $ age hieght;
if age le 10;
datalines;
John McCloskey 35 71
June Rosesette 10 43
Tineke Jones 9 37
;
run;

Two blanks between name and age...

siva said...

Answer C

hemanth said...

if we specifies name variable length as 14 what will happen

Ryan Lo said...

Answer is C.

Please see SASGuru's comment.

All the length of variables is 8, by default.

Unknown said...

C

Atif Momin said...

answer is B

Altamash Ansari said...

Atif, Can you please explain why B?

Unknown said...

but the program after execution only gives one observation as output unless missover is included .

data new;
infile datalines;
input name & $ age height;
if age le 10;
datalines;
John McCloskey 35 71
June Rosesette 10 43
Tineke Jones 9 37
;
run;
proc print;
run;

Sridhar Panthangi said...

Answer D, because name variable's length is not defined, it is having space between name string

Sridhar Panthangi said...

dataset will be created but not complete, it is with error

Anonymous said...

I agree with Syed Zakr, this only gives one observation with missing data for both age and height.
the following error in the log.
NOTE: Invalid data for age in line 63 1-4.
NOTE: Invalid data for hieght in line 63 6-14.

NewSASer said...

The following script provides correct answer:

data banks;
input name $15. @16 age height;
if age LE 10;
cards;
John McCloskey 35 71
June Rosesette 10 43
Tineke Jones 9 37
;
run;

Bharanitharan said...

Ans:C

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