SAS Chapter 13: Creating Samples And Indexes

10 Questions | Total Attempts: 79

SettingsSettingsSettings
SAS Quizzes & Trivia

Practice for the SAS advance certification exam.


Questions and Answers
  • 1. 
    The variable that is created by the POINT= option is assigned a value
    • A. 

      Automatically during compilation of the DATA step.

    • B. 

      Automatically during execution of the DATA step.

    • C. 

      During compilation of the DATA step, by program statements.

    • D. 

      During execution of the DATA step, by program statements.

  • 2. 
    Which of the following programs correctly creates a systematic sample from a data set with an unknown number of observations and outputs these sample observations to a data set named Sample?
    • A. 

      data sample; set sasuser.sale2000 point=thisone nobs=totnum; output; stop; run;

    • B. 

      data sample; do thisone=100 to totnum by 100; set sasuser.sale2000 point=thisone nobs=totnum; output; end; stop; run;

    • C. 

      data sample; do thisone=100 to 1000 by 100; set sasuser.sale2000 point=thisone; output; end; stop; run;

    • D. 

      data sample; do thisone=100 to totnum by 100; set sasuser.sale2000 point=thisone nobs=totnum; end; run;

  • 3. 
    Which of the following expressions will generate a random integer between 1 and 50?
    • A. 

      Ceil(ranuni(50))

    • B. 

      Ranuni(50)

    • C. 

      Ceil(ranuni(0)*50)

    • D. 

      Ceil(ranuni(0))*50

  • 4. 
    An index
    • A. 

      Is an optional file that is associated with a data set.

    • B. 

      Provides direct access to specific observations of a data set, based on the value of one or more key variables.

    • C. 

      Can be classified as simple or composite, either of which can consist of unique values.

    • D. 

      All of the above

  • 5. 
    Which of the following correctly creates a data set named Flights from the Sasuser.Revenue data set, creates a composite index namedFromto that is based on the values of Origin and Dest, and prints informational messages about the index to the SAS log?
    • A. 

      options msglevel=i; data flights index=(Fromto=origin dest); set sasuser.revenue; run;

    • B. 

      options msglevel=n; data flights (index=(Fromto=origin dest)); set sasuser.revenue; run;

    • C. 

      options msglevel=i; data flights (index=(Fromto=(origin dest))); set sasuser.revenue; run;

    • D. 

      options msglevel=n; data flights (index=Fromto); set sasuser.revenue; run;

  • 6. 
    Which of the following is true?
    • A. 

      When you add observations to a data set, the index(es) are automatically updated with additional value/identifier pairs.

    • B. 

      When you rename a variable that is used as the key variable in a simple index, you must re-create the index.

    • C. 

      When you delete a data set, the index file remains until you delete it as well.

    • D. 

      When you copy a data set with the COPY statement, you must also copy the index file in another step.

  • 7. 
    To create an index on an existing data set, you use
    • A. 

      PROC DATASETS.

    • B. 

      PROC SQL.

    • C. 

      The DATA step with the INDEX= option, to rebuild the data set.

    • D. 

      Any of the above

  • 8. 
    Which of the following correctly creates a simple index named Origin on the Revenue data set?
    • A. 

      proc sql; create index origin on revenue(origin); quit;

    • B. 

      proc sql; modify revenue; index=origin; quit;

    • C. 

      proc sql data=revenue; create index origin; quit;

    • D. 

      proc sql; index=origin on revenue; quit;

  • 9. 
    To view a list of the indexes that are associated with a data set, you use
    • A. 

      PROC COPY or the COPY statement in PROC DATASETS.

    • B. 

      PROC CONTENTS or the CONTENTS statement in PROC DATASETS.

    • C. 

      The MSGLEVEL= system option and a PROC PRINT step.

    • D. 

      Any of the above

  • 10. 
    Suppose that the Sasuser.Revenue data set has a simple index named FlightID. For which of the following programs will the index be used?
    • A. 

      proc print data=sasuser.revenue; where flightid ne 'IA11200'; run;

    • B. 

      data someflights; set sasuser.revenue; where flightid > 'IA11200'; run;

    • C. 

      data someflights; set sasuser.revenue; if flightid > 'IA11200'; run;

    • D. 

      proc print data=sasuser.revenue; where origin='RDU' or flightid='IA03400'; run;

Related Topics
Back to Top Back to top