Date: Fri, 20 Jul 2007 09:17:04 -0400
Reply-To: Paul Bartells <paul.bartells@TXU.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Paul Bartells <paul.bartells@TXU.COM>
Subject: Re: Please help with these qns
On Fri, 20 Jul 2007 11:46:12 +0800, VORA Mihir <VORAM@ESSILOR.COM.SG> wrote:
>Below are the answers to your questions:
>1) A. 5 DOG
>Explanation: value of amount is changed after the if statement so the new
>value of 5 comes in place of 7.
>2) B. 12
>Explanation: As you are trying to find the value of "i" and the find
>function being case sensitive it searches for the first occurrence of small
>"i" and ignores the first capital "I" in the string. It returns the
>of the "i" of ireland and thus returns 12.
>3) D. . (Missing value)
>Explanation: According to the code you should not be even getting the value
>of Sue in your final test dataset. However if we add an @ after the first
>input line or have truncover after the infile line then Sue's age value
>would be 3 or 0 respectively. However as 3 or 0 is not an option I guess
>best or the closest answer would be D. . (Missing value)
>From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
>Sent: Friday, July 20, 2007 11:03 AM
>Subject: Please help with these qns
>1. data work.new;
>length word $7;
>if amount = 5 then word='CAT';
>if amount = 7 then word='DOG';
>else word = 'NONE!!!';
>WHICH ONE OF THE FOLLOWING REPRESENTS THE VALUES OF AMOUNT AND WORD
>A. 5 DOG
>B. 5 CAT
>C. 7 DOG
>D. 7 (MISSING CHARAC VALUE)
>2. Data Combine;
> Country = 'Italy, Russia, ireland;
>Found = find (country,'i');
>What is the value of the variable Found?
>3. The contents of the raw data file EMPLOYEE are listed below:
>ruth 39 11
>jose 32 22
>sue 30 33
>john 40 44
>The following SAS program is submitted
>input employee_name $1-4;
>if employee_name='sue' then input age 7-8;
>else input idnum 10-11;
>which one of the following values does the variable AGE contain when
>the name of the employee is 'Sue';?
>D. .(missing numeric value)
Since you saw fit to attempt to answer the questions, I must take issue
with some of your answers.
Question 1 is fine.
Question 2, however, is not. As submitted, the code will not work due to a
missing quote at the end of the Country string assignment. Therefore, the
FIND function will never be seen.
Question 3 had the correct answer, but for the wrong reason. True, a
trailing @ sign is needed on the input statement. But even with that the
code will not find 'Sue' because the input had 'sue' (lower case). The
input statement also looks strange. I believe a space is required between
the character designator and the column range (e.g., $ 1-4 instead of $1-4).
Still, Howard's response is the best one. Don't ask this group to do your
homework for you. But with any submission, make sure it's typed correctly
if you hope to get reliable assistance.