Chapter Quiz

Select the best answer for each question. Check your answers using the answer key in the appendix.
  1. Which statement is false regarding the use of DO loops?
    1. They can contain conditional clauses.
    2. They can generate multiple observations.
    3. They can be used to combine DATA and PROC steps.
    4. They can be used to read data.
  2. During each execution of the following DO loop, the value of Earned is calculated and is added to its previous value. How many times does this DO loop execute?
    data work.earnings; 
      Amount=1000; 
      Rate=.075/12; 
      do month=1 to 12; 
        Earned+(amount+earned)*rate; 
      end; 
    run;
    1. 0
    2. 1
    3. 12
    4. 13
  3. On January 1 of each year, $5,000 is invested in an account. Complete the DATA step below to determine the value of the account after 15 years if a constant interest rate of 10% is expected.
    data work.invest; 
      ... 
        Capital+5000; 
        capital+(capital*.10); 
      end; 
    run;
    1. do count=1 to 15;
    2. do count=1 to 15 by 10%;
    3. do count=1 to capital;
    4. do count=capital to (capital*.10);
  4. In the data set Work.Invest, what would be the stored value for Year?
    data work.invest; 
      do year=1990 to 2004; 
        Capital+5000; 
        capital+(capital*.10); 
      end; 
    run;
    1. missing
    2. 1990
    3. 2004
    4. 2005
  5. Which of the following statements is false regarding the program shown below?
    data work.invest; 
      do year=1990 to 2004; 
        Capital+5000; 
        capital+(capital*.10); 
        output; 
      end; 
    run;
    1. The OUTPUT statement writes current values to the data set immediately.
    2. The last value for Year in the new data set is 2005.
    3. The OUTPUT statement overrides the automatic output at the end of the DATA step.
    4. The DO loop performs 15 iterations.
  6. How many observations will the data set Work.Earn contain?
    data work.earn; 
      Value=2000; 
      do year=1 to 20; 
        Interest=value*.075; 
        value+interest; 
        output; 
      end; 
    run;
    1. 0
    2. 1
    3. 19
    4. 20
  7. Which of the following would you use to compare the result of investing $4,000 a year for five years in three different banks that compound interest monthly? Assume a fixed rate for the five-year period.
    1. DO WHILE statement
    2. nested DO loops
    3. DO UNTIL statement
    4. a DO group
  8. Which statement is false regarding DO UNTIL statements?
    1. The condition is evaluated at the top of the loop, before the enclosed statements are executed.
    2. The enclosed statements are always executed at least once.
    3. SAS statements in the DO loop are executed until the specified condition is true.
    4. The DO loop must have a closing END statement.
  9. Select the DO WHILE statement that would generate the same result as the program below.
    data work.invest; 
      capital=100000; 
      do until(Capital gt 500000); 
        Year+1; 
        capital+(capital*.10); 
      end; 
    run;
    1. do while(Capital ge 500000);
    2. do while(Capital=500000);
    3. do while(Capital le 500000);
    4. do while(Capital>500000);
  10. In the following program, complete the statement so that the program stops generating observations when Distance reaches 250 miles or when 10 gallons of fuel have been used.
    data work.go250; 
      set cert.cars; 
      do gallons=1 to 10 ... ; 
        Distance=gallons*mpg; 
        output; 
      end; 
    run;
    1. while(Distance<=250)
    2. when(Distance>250)
    3.  over(Distance le 250)
    4. until(Distance=250)
Last updated: August 23, 2018
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.151.71