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 cert.furnture;
        if finish='oak';
        if price<100 then delete;
        TotalPrice+price;
        drop price;
      run;
      proc print data=test2 noobs;
      run;
      
    2. data test2;
        set cert.furnture;
        if finish='oak' and price<200;
        TotalPrice+price;
        drop price;
      run;
      proc print data=test2 noobs;
      run;
      
    3. data test2;
        set cert.furnture;
        if finish='oak' and price<200 then delete;
        TotalPrice+price;
        drop price;
          run;
      proc print data=test2 noobs;
      run;
      
    4. data test2;
        set cert.furnture;
        if finish='oak' and price<100 then do;
          TotalPrice+price;
            drop price;
        end;
      run;
      proc print data=test2 noobs;
      run;
      
  2. 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')
  3. 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
  4. 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
  5. 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'; 
  6. What is the length of the variable Type, as created in the DATA step below?
    data work.newloan;     
      set cert.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.
  7. Which program contains an error?
    1. data stresstest(drop=timemin timesec);       
        set cert.tests;
        TotalTime=(timemin*60)+timesec;       
        SumSec+totaltime;        
      run;
    2. proc print data=stresstest;       
        label totaltime='Total Duration of Test';       
        drop sumsec;        
      run; 
    3. proc print data=stresstest(keep=totaltime timemin);          
         label totaltime='Total Duration of Test';           
      run;
    4. data stresstest;      
        set cert.tests;       
        TotalTime=(timemin*60)+timesec;       
        keep id totaltime tolerance;    
      run;
  8. If you submit the following program, which variables appear in the new data set?
    data work.cardiac(drop=age group); 
      set cert.fitness(keep=age weight group); 
      if group=2 and age>40; 
    run;
    1. none
    2. Weight
    3. Age, Group
    4. Age, Weight, Group
  9. Which of the following programs correctly reads the data set Orders and creates the data set FastOrdr?
    1. data cert.fastordr(drop=ordrtime); 
        set cert.orders(keep=product units price); 
        if ordrtime<4; 
        Total=units*price; 
      run;
    2. data cert.orders(drop=ordrtime);
        set cert.fastordr(keep=product units price);
        if ordrtime<4; 
        Total=units*price; 
      run;
    3. data cert.fastordr(drop=ordrtime);
         set cert.orders(keep=product units price 
                         ordrtime); 
         if ordrtime<4; 
         Total=units*price; 
      run;
    4. none of the above
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.118.208.97