SAS Chapter 5

10 Questions

Settings
Questions and Answers
  • 1. 
    Which SAS statement associates the fileref Crime with the raw data file C:\States\Data\Crime?
    • A. 

      Filename crime 'C:\States\Data\Crime';

    • B. 

      Filename crime C:\States\Data\Crime;

    • C. 

      Fileref crime 'C:\States\Data\Crime';

    • D. 

      Filename 'C:\States\Data\Crime' crime;

  • 2. 
    Filerefs remain in effect until...
    • A. 

      You change them

    • B. 

      You cancel them

    • C. 

      You end your SAS session.

    • D. 

      All of the above

  • 3. 
    Which statement identifies the name of a raw data file to be read with the fileref Products and specifies that the DATA step read only records 1-15?
    • A. 

      Infile products obs 15;

    • B. 

      Infile products obs=15;

    • C. 

      Input products obs=15;

    • D. 

      Input products 1-15;

  • 4. 
    • A. 

      Data_null_;      set work.patients;      infile 'c:\clinic\patients\referrals.dat';      input id 1-4 sex 6 age 8-9 height 11-12           weight 14-16 pulse 18-20; run;

    • B. 

      Data referrals.dat;      set work.patients;      input id 1-4 sex 6 age 8-9 height 11-12           weight 14-16 pulse 18-20; run;

    • C. 

      Data _null_;      set work.patients;      file c:\clinic\patients\referrals.dat;      put id 1-4 sex 6 age 8-9 height 11-12           weight 14-16 pulse 18-20; run;

    • D. 

      Data _null_;      set work.patients;      file 'c:\clinic\patients\referrals.dat';      put id 1-4 sex 6 age 8-9 height 11-12           weight 14-16 pulse 18-20; run;

  • 5. 
    Which raw data file can be read using column input?
    • A. 
    • B. 
    • C. 
    • D. 

      All of the above

  • 6. 
    • A. 

      Data work.salesrep;      infile empdata;      input ID $ 1-4 LastName $ 6-12           FirstName $ 14-18 City  $ 20-29; run; proc print data=work.salesrep; run;

    • B. 

      Data work.salesrep;      infile empdata;      input ID $ 1-4 Name $ 6-12           FirstName $ 14-18 City $ 20-29; run; proc print data=work.salesrep; run;

    • C. 

      Data work.salesrep;      infile empdata;      input ID $ 1-4 name1 $ 6-12           name2 $ 14-18 City $ 20-29; run; proc print data=work.salesrep; run;

    • D. 

      All of the above

  • 7. 
    • A. 

      Input StockNumber $ 1-3 Finish $ 5-9 Style $ 11-18      Item $ 20-24 Price 27-32;

    • B. 

      Input StockNumber $ 1-3 Price 27-32      Item $ 20-24 Finish $ 5-9 Style $ 11-18;

    • C. 

      Input $ StockNumber 1-3 Price 27-32 $      Item 20-24 $ Finish 5 9 $ Style 11-18;

    • D. 

      Input StockNumber $ 1-3 Price $ 27-32      Item $ 20-24 Finish $ 5-9 Style $ 11-18;

  • 8. 
    Which statement correctly re-defines the values of the variable Income as 100 percent higher?
    • A. 

      Income=income*1.00;

    • B. 

      Income=income+(income*2.00);

    • C. 

      Income=income*2;

    • D. 

      Income=*2;

  • 9. 
    Which program correctly reads instream data;
    • A. 

      Data finance.newloan;      input datalines;      if country='JAPAN';      MonthAvg=amount/12; 1998 US     CARS       194324.12 1998 US     TRUCKS     142290.30 1998 CANADA CARS        10483.44 1998 CANADA TRUCKS      93543.64 1998 MEXICO CARS        22500.57 1998 MEXICO TRUCKS      10098.88 1998 JAPAN  CARS        15066.43 1998 JAPAN  TRUCKS      40700.34 ;

    • B. 

      Data finance.newloan;      input Year 1-4 Country $ 6-11            Vehicle $ 13-18 Amount 20-28;      if country='JAPAN';      MonthAvg=amount/12;      datalines; run;

    • C. 

      Data finance.newloan;      input Year 1-4 Country 6-11            Vehicle 13-18 Amount 20-28;      if country='JAPAN';      MonthAvg=amount/12;      datalines; 1998 US     CARS       194324.12 1998 US     TRUCKS     142290.30 1998 CANADA CARS        10483.44 1998 CANADA TRUCKS      93543.64 1998 MEXICO CARS        22500.57 1998 MEXICO TRUCKS      10098.88 1998 JAPAN  CARS        15066.43 1998 JAPAN  TRUCKS      40700.34 ;

    • D. 

      Data finance.newloan;      input Year 1-4 Country $ 6-11            Vehicle $ 13-18 Amount 20-28;      if country='JAPAN';      MonthAvg=amount/12;      datalines; 1998 US     CARS       194324.12 1998 US     TRUCKS     142290.30 1998 CANADA CARS        10483.44 1998 CANADA TRUCKS      93543.64 1998 MEXICO CARS        22500.57 1998 MEXICO TRUCKS      10098.88 1998 JAPAN  CARS        15066.43 1998 JAPAN  TRUCKS      40700.34 ;

  • 10. 
    Which SAS statement subsets the raw data shown below so that only the observations in which Sex (in the second field) has a value of F are processed?
    • A. 

      If sex=f;

    • B. 

      If sex=F;

    • C. 

      If sex='F';

    • D. 

      A or b