Click on the Comments to view the Answers

Sunday, January 24, 2010

Base 12

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


--------10-------20-------30
72 95


The following SAS program is submitted:


data test;
infile 'size';
input @1 height 2. @4 weight 2;
run;


Which one of the following is the value of the variable WEIGHT in the output data set?
A. 2
B. 72
C. 95
D. . (missing numeric value)

6 comments:

SASGuru said...

Answer: A

The start column for weight has been mentioned as 2… So SAS reads in 2 in the value of 72

Execute this and c for yourself…the answers are 2,0,1 for each observations..

data work.TEST;
infile cards;
input @1 height 2. @4 weight 2;
cards;
72 95
60 91
11 22
;
run;

kat said...

eventhough the start column for weight says @4, sas still thinks 2 is the start column? why is that?

Josh Jeremiah said...

The 2 after weight needs a period following it to create a weight value of 95.

Abhijit Pawar said...

data work.TEST1;
infile cards;
input @1 height 2. @4 weight 1;put _all_;
cards;
72 95
60 91
13 22
;

height=72 weight=7 _ERROR_=0 _N_=1
height=60 weight=6 _ERROR_=0 _N_=2
height=13 weight=1 _ERROR_=0 _N_=3

actually weight 1 considers column 1 of raw data file or datalines

if i consider weight 3 then

data work.TEST1;
infile cards;
input @1 height 2. @4 weight 3;put _all_;
cards;
72 95
60 91
13 22
;


height=72 weight=. _ERROR_=0 _N_=1
height=60 weight=. _ERROR_=0 _N_=2
height=13 weight=. _ERROR_=0 _N_=3
then it gives missing values , since in column 3 is blank




data work.TEST1;
infile cards;
input @1 height 2. @4 weight 2;put _all_;
cards;

height=72 weight=2 _ERROR_=0 _N_=1
height=60 weight=0 _ERROR_=0 _N_=2
height=13 weight=3 _ERROR_=0 _N_=3



H. C. said...

A

Ram Immidisetti said...

data work.TEST;
infile cards;
input @1 height 2. @4 weight 2.;
cards;
72 95
60 91
11 22
;
run;
this gives weight 95,91,22

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