LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (November 2009, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 11 Nov 2009 12:34:00 -0600
Reply-To:   Joe Matise <snoopy369@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Joe Matise <snoopy369@GMAIL.COM>
Subject:   Re: Base sas certification question (Found somewhere )
Comments:   To: SAS_learner <proccontents@gmail.com>
In-Reply-To:   <c2192a610911111016r48a0ff4cpe9d55627c4e420a5@mail.gmail.com>
Content-Type:   text/plain; charset=windows-1252

Not to answer the question directly, but to lead to the answer: The input statement is not operating as expected. In my opinion, if I were reading real-life code like this, I would expect that the programmers' desired results are not being achieved here [whatever they may be]. It highlights a very common error in coding conditional input statements.

There's something missing from the first input statement, that would cause it to work in the 'expected' fashion. It's a single character, and it should appear immediately preceding the semicolon [ie, at the conclusion of the statement]. Can you see what it is? If you answer that question, then not only do you learn what you should from this question, but you also should easily see the reason for the answer.

-Joe

On Wed, Nov 11, 2009 at 12:16 PM, SAS_learner <proccontents@gmail.com>wrote:

> Base sas certification question > Flat file structure is as below > 1----5----10 > dan 23 45 > bob 44 50 > sue 30 80 > mam 40 50 > > The following code is submitted. > data temp; > infile ‘file specification’; > input x $ 1-3; > if x='sue' then input age 5-6; > else input height 8-9; > run; > > what would be the value of variable AGE in the dataset TEMP when variable X > has the value ‘Sue’? > a) 30 > b) 44 > c) 40 > d) 55 > > Ans: c > > can anyone plz explain me why the ans is 40. Thanks in advance. > > Thanks > SL >


Back to: Top of message | Previous page | Main SAS-L page