Chapter Quiz

Select the best answer for each question. Check your answers using the answer key in the appendix.
  1. Which SAS statement associates the fileref Crime with the raw data file C:StatesDatacrime.dat?
    1. filename crime 'c:statesdatacrime.dat';
    2. filename crime c:statesdatacrime.dat;
    3. fileref crime 'c:statesdatacrime.dat';
    4. filename 'c:statesdatacrime' crime.dat;
  2. How long do filerefs remain in effect?
    1. until you change them
    2. until you cancel them
    3. until you end your SAS session
    4. 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?
    1. infile products obs 15;
    2. infile products obs=15;
    3. input products obs=15;
    4. input products 1-15;
  4. Which of the following programs correctly writes the observations from the data set below to a raw data file?
    Data Set work.patients
    1. data _null_;
         set work.patients; 
         infile 'c:clinicpatients
      eferals.dat'; 
         input id $ 1-4 sex 6 $ age 8-9 height 11-12 
               weight 14-16 pulse 18-20; 
      run;
    2. data referals.dat; 
         set work.patients; 
         input id $ 1-4 sex $ 6 age 8-9 height 11-12 
               weight 14-16 pulse 18-20; 
      run;
    3. data _null_; 
         set work.patients; 
         file c:clinicpatients
      eferals.dat; 
         put id $ 1-4 sex 6 $ age 8-9 height 11-12 
              weight 14-16 pulse 18-20; 
      run;
    4. data _null_; 
         set work.patients; 
         file 'c:clinicpatients
      eferals.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?
    1. Raw Data File A
    2. Raw Data File B
    3. Raw Data File C
    4. all of the above.
  6. Which program creates the output shown below?
    Data and Output
    1. 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;
    2. 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;
    3. 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;
    4. all of the above.
  7. Which statement correctly reads the fields in the following order: StockNumber, Price, Item, Finish, Style?
    Field Name
    Start Column
    End Column
    Data Type
    StockNumber
    1
    3
    character
    Finish
    5
    9
    character
    Style
    11
    18
    character
    Item
    20
    24
    character
    Price
    27
    32
    numeric
    Raw Data
    1. input StockNumber $ 1-3 Finish $ 5-9 Style $ 11-18  
            Item $ 20-24 Price 27-32;
    2. input StockNumber $ 1-3 Price 27-32  
            Item $ 20-24 Finish $ 5-9 Style $ 11-18;
    3.  input $ StockNumber 1-3 Price 27-32  $ 
            Item  20-24 $ Finish 5-9 $ Style 11-18;
    4. input StockNumber $ 1-3 Price $ 27-32 
            Item $ 20-24 Finish $ 5-9 Style $ 11-18;
  8. Which statement correctly redefines the values of the variable Income as 100% higher?
    1. income=income*1.00;
    2. income=income+(income*2.00);
    3. income=income*2;
    4. income=*2;
  9. Which program correctly reads instream data?
    1. 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 
      ;
    2. data finance.newloan; 
         input Year 1-4 Country $ 6-11  
               Vehicle $ 13-18 Amount 20-28; 
         if country='JAPAN'; 
         MonthAvg=amount/12; 
         datalines; 
      run;
    3. 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 
      ;
    4. 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?
    Raw Data
    1. if sex=f;
    2. if sex=F;
    3. if sex='F';
    4. a or b
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.15.140.68