Chapter Quiz

Select the best answer for each question. Check your answers using the answer key in the appendix.
  1. Given the following data set, which program creates the output shown below?
    Input 1
    Output 1
    1. data test2;
          set sasuser.furnture;
          if finish='oak';
          if price<100 then delete;
          TotalPrice+price;
          drop price;
      run;
      proc print data=test2 noobs;
      run;
      
    2. data test2;
          set sasuser.furnture;
          if finish='oak' and price<200;
          TotalPrice+price;
          drop price;
      run;
      proc print data=test2 noobs;
      run;
      
    3. data test2;
          set sasuser.furnture;
          if finish='oak' and price<200 then delete;
          TotalPrice+price;
          drop price;
          run;
      proc print data=test2 noobs;
      run;
      
    4. data test2;
          set sasuser.furnture;
          if finish='oak' and price<100 then do;
            TotalPrice+price;
             drop price;
          end;
      run;
      proc print data=test2 noobs;
      run;
      
  2. How is the variable Amount labeled and formatted in the PROC PRINT output?
    data credit;    
       infile creddata;    
       input Account $ 1-5 Name $ 7-25 Type $ 27   
                 Transact $ 29-35 Amount 37-50;     
       label amount='Amount of Loan';    
       format amount dollar12.2;        
    run;    
    proc print data=credit label;    
       label amount='Total Amount Loaned';    
       format amount comma10.;    
    run;
    1. label Amount of Loan, format DOLLAR12.2
    2. label Total Amount Loaned, format COMMA10.
    3. label Amount, default format
    4. The PROC PRINT step does not execute because two labels and two formats are assigned to the same variable.
  3. Consider the IF-THEN statement shown below. When the statement is executed, which expression is evaluated first?
    if finlexam>=95     
       and (research='A' or    
           (project='A' and present='A'))     
       then Grade='A+'; 
    1. finlexam>=95
    2. research='A'
    3. project='A' and present='A'
    4.  research='A' or 
      (project='A' and present='A')
  4. Consider the small raw data file and program shown below. What is the value of Count after the fourth record is read?
    data work.newnums; 
       infile numbers; 
       input Tens 2-3; 
       Count+tens; 
    run;
    raw data file
    1. missing
    2. 0
    3. 30
    4. 70
  5. Consider the revised program below. What is the value of Count after the third observation is read?
    data work.newnums;
       infile numbers; 
       input Tens 2-3; 
       retain Count 100; 
       count+tens; 
    run;
    revised program
    1. missing
    2. 0
    3. 100
    4. 130
  6. For the observation shown below, what is the result of the IF-THEN statements?
    Status
    Type
    Count
    Action
    Control
    OK
    3
    12
    E
    Go
    if status='OK' and type=3   
       then Count+1;    
    if status='S' or action='E'    
       then Control='Stop'; 
    1. Count = 12    Control = Go
    2. Count = 13    Control =Stop
    3. Count = 12    Control =Stop
    4. Count = 13    Control = Go
  7. Which of the following can determine the length of a new variable?
    1. the length of the variable's first reference in the DATA step
    2. the assignment statement
    3. the LENGTH statement
    4. all of the above
  8. Which set of statements is equivalent to the code shown below?
    if code='1' then Type='Fixed';    
    if code='2' then Type='Variable';    
    if code^='1' and code^='2' then Type='Unknown';
    1. if code='1' then Type='Fixed';        
      else if code='2' then Type='Variable';        
      else Type='Unknown'; 
    2.  if code='1' then Type='Fixed';        
      if code='2' then Type='Variable';        
      else Type='Unknown';
    3. if code='1' then type='Fixed';        
      else code='2' and type='Variable';        
      else type='Unknown'; 
    4. if code='1' and type='Fixed';        
      then code='2' and type='Variable';        
      else type='Unknown'; 
  9. What is the length of the variable Type, as created in the DATA step below?
    data finance.newloan;     
       set finance.records;     
       TotLoan+payment;     
       if code='1' then Type='Fixed';     
       else Type='Variable';     
       length type $ 10;     
    run;
    1. 5
    2. 8
    3. 10
    4. It depends on the first value of Type.
  10. Which program contains an error?
    1. data clinic.stress(drop=timemin timesec);       
         infile tests;       
         input ID $ 1-4 Name $ 6-25 RestHR 27-29 MaxHR 31-33    
               RecHR 35-37 TimeMin 39-40 TimeSec 42-43    
               Tolerance $ 45;       
         TotalTime=(timemin*60)+timesec;       
         SumSec+totaltime;        
      run;
    2. proc print data=clinic.stress;       
         label totaltime='Total Duration of Test';       
         format timemin 5.2;       
         drop sumsec;        
      run; 
    3. proc print data=clinic.stress(keep=totaltime timemin);          
         label totaltime='Total Duration of Test';           
         format timemin 5.2;       
      run;
    4. data clinic.stress;      
         infile tests;       
         input ID $ 1-4 Name $ 6-25 RestHR 27-29 MaxHR 31-33      
               RecHR 35-37 TimeMin 39-40 TimeSec 42-43 
               Tolerance $ 45;       
         TotalTime=(timemin*60)+timesec;       
         keep id totaltime tolerance;    
      run;
Last updated: January 10, 2018
..................Content has been hidden....................

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