Question : You need to find that how many year it will take to reach your INR investment every year with % compounding interest rate to have 100000 or more, which of the following you will consider?
Correct Answer : Get Lastest Questions and Answer : Explanation: As we know, what should be our final value. In this case our final value is more than 100000 INR. So we can use DO UNTIL loop. Because we dont know, how many years it will take, hence not aware about the number iterations. So simple DO loop is not helpful. IF and where conditions is also not helpful. See example below
data course100 (drop=index); do until(TOTAL_INCOME>100000); TOTAL_INCOME+5000; TOTAL_INCOME+TOTAL_INCOME*.10; YEAR+1; output; put _all_; end; run;
Question : Which of the following statements are correct, with regards to DO UNTIL statement
A. DO UNTIL statement will always execute enclosed statements at least once. B. DO UNTIL statement may not execute enclosed statements if condition is true at the start. C. All the enclosed statements will be executed if condition until become true. D. END; statement is not mandatory its optional.
Correct Answer : Get Lastest Questions and Answer : Explanation: Any looping statement required END; statement to close. Hence, option 4 is out. When you use Do UNTIL, it will execute it at least once. Option 3 is also correct, until condition become true all the enclosed statements will be executed. As soon as until become true it will exit.
Question : You have been given a below SAS program
data course100 (drop=index); do until(TOTAL_INCOME>100000); TOTAL_INCOME+5000; TOTAL_INCOME+TOTAL_INCOME*.10; YEAR+1; output; put _all_; end; run;
Select the DO while statement which can be replace with the DO UNTIL statement?
Correct Answer : Get Lastest Questions and Answer : Explanation: In case of while statement, if first statement become false than, while loop will never be executed. Hence, in option condition become true TOTAL_INCOME<100000, so it will be executed until condition become false.