SAS Chapter 11 Creating And Managing Variables

10 Questions | Total Attempts: 177

SettingsSettingsSettings
SAS Chapter 11 Creating And Managing Variables

Practice for the SAS basic certification exam.


Questions and Answers
  • 1. 
    Which program creates the output shown below?
    • A. 

      Data test2;    infile furnture;    input StockNum $ 1-3 Finish $ 5-9 Style $ 11-18          Item $ 20-24 Price 26-31    if finish='oak' then delete;    retain TotPrice 100;    totalprice+price;    drop price; run; proc print data=test2 noobs; run;

    • B. 

      Data test2;    infile furnture;    input StockNum $ 1-3 Finish $ 5-9 Style $ 11-18          Item $ 20-24 Price 26-31    if finish='oak' and price<200 then delete;    totalprice+price; run; proc print data=test2 noobs; run;

    • C. 

      Data test2(drop=price);    infile furnture;    input StockNum $ 1-3 Finish $ 5-9 Style $ 11-18          Item $ 20-24 Price 26-31    if finish='oak' and price<200 then delete;    totalprice+price; run; proc print data=test2 noobs; run;

    • D. 

      Data test2;    infile furnture;    input StockNum $ 1-3 Finish $ 5-9 Style $ 11-18          Item $ 20-24 Price 26-31    if finish='oak' and price<200 then delete;    totalprice+price; 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 dollar 12.2; run; proc print data=credit label;    label amount='Total Amount Loaned';    format amount comma10.; run;
    • A. 

      Label Amount of Loan, format DOLLAR12.2

    • B. 

      Label Total Amount Loaned, format COMMA10.

    • C. 

      Label Amount, default format

    • D. 

      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+';
    • A. 

      Finlexam>=95

    • B. 

      Research='A'

    • C. 

      Project='A' and present='A'

    • D. 

      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?
    • A. 

      Missing

    • B. 

      0

    • C. 

      30

    • D. 

      70

  • 5. 
    Now consider the revised program below.  What is the value of Count after the third observation is read?
    • A. 

      Missing

    • B. 

      0

    • C. 

      100

    • D. 

      130

  • 6. 
    For the observation show below, what is the result of the IF-THEN statements? if status='OK' and type=3    then Count+1; if status='S' or action='E'    then Control='Stop';
    • A. 

      Count = 12 Control = Go

    • B. 

      Count = 13 Control = Stop

    • C. 

      Count = 12 Control = Stop

    • D. 

      Count = 13 Control = Go

  • 7. 
    Which of the following can determine the length of a new variable?
    • A. 

      The length of the variable's first value

    • B. 

      The assignment statement

    • C. 

      The LENGTH statement

    • D. 

      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';
    • A. 

      If code='1' then Type='Fixed'; else if code='2' then Type='Variable'; else Type='Unknown';

    • B. 

      If code='1' then Type='Fixed'; if code='2' then Type='Variable'; else Type='Unknown';

    • C. 

      If code='1' then type='Fixed'; else code='2' and type='Variable'; else type='Unknown';

    • D. 

      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.records;    set finance.records;    TotLoan+payment;    if code='1' then Type='Fixed';    else Type='Variable';    length type $ 10; run;
    • A. 

      5

    • B. 

      8

    • C. 

      10

    • D. 

      It depends on the first value of Type

  • 10. 
    Which program contains an error?
    • A. 

      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;

    • B. 

      Proc print data=clinic.stress;    label totaltime='Total Duration of Test';    format timemin 5.2;    drop sumsec; run;

    • C. 

      Proc print data=clinic.stress(keep=totaltime timemin);    label totaltime='Total Duration of Test';    format timemin 5.2; run;

    • D. 

      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;

Related Topics
Back to Top Back to top