Chapter 5: Creating And Managing Tables Using Proc SQL

10 Questions | Total Attempts: 54

SettingsSettingsSettings
Please wait...
SQL Quizzes & Trivia

Practice for the SAS advance certification exam


Questions and Answers
  • 1. 
    Which of the following PROC SQL steps creates a new table by copying only the column structure (but not the rows) of an existing table?
    • A. 

      proc sql; create table work.newpayroll as select * from sasuser.payrollmaster;

    • B. 

      proc sql; create table work.newpayroll like sasuser.payrollmaster;

    • C. 

      proc sql; create table work.newpayroll copy sasuser.payrollmaster;

    • D. 

      proc sql; create table work.newpayroll describe sasuser.payrollmaster;

  • 2. 
    Which of the following PROC SQL steps creates a table that contains rows for the level-1 flight attendants only?
    • A. 

      proc sql; create table work.newpayroll as select * from sasuser.payrollmaster where jobcode='FA1';

    • B. 

      proc sql; create work.newpayroll as select * from sasuser.payrollmaster where jobcode='FA1';

    • C. 

      proc sql; create table work.newpayroll copy sasuser.payrollmaster where jobcode='FA1';

    • D. 

      proc sql; create table work.newpayroll as sasuser.payrollmaster where jobcode='FA1';

  • 3. 
    Which of the following statements is true regarding the UNDO_POLICY=REQUIRED option?
    • A. 

      It must be used with the REQUIRED integrity constraint.

    • B. 

      It ignores the specified integrity constraints if any of the rows that you want to insert or update do not meet the constraint criteria.

    • C. 

      It restores your table to its original state if any of the rows that you try to insert or update do not meet the specified integrity constraint criteria.

    • D. 

      It allows rows that meet the specified integrity constraint criteria to be inserted or updated, but rejects rows that do not meet the integrity constraint criteria.

  • 4. 
    Which of the following is not a type of integrity constraint?
    • A. 

      CHECK

    • B. 

      NULL

    • C. 

      UNIQUE

    • D. 

      PRIMARY KEY

  • 5. 
    Which of the following PROC SQL steps deletes rows for all frequent-flyer program members who traveled less than 10,000 miles?
    • A. 

      proc sql; delete rows from work.frequentflyers where milestraveled < 10000;

    • B. 

      proc sql; drop rows from work.frequentflyers where milestraveled < 10000;

    • C. 

      proc sql; drop table from work.frequentflyers where milestraveled < 10000;

    • D. 

      proc sql; delete from work.frequentflyers where milestraveled < 10000;

  • 6. 
    Which of the following PROC SQL steps gives bonuses (in points) to frequent-flyer program members as follows:
    • a 50% bonus for members who traveled less than 10,000 miles
    • a 100% bonus for members who traveled 10,000 miles or more?
    • A. 

      proc sql; update work.frequentflyers set pointsearned=pointsearned* case if milestraveled < 10000 then 1.5 if milestraveled >= 10000 then 2 else 1 end;

    • B. 

      proc sql; update work.frequentflyers set pointsearned=pointsearned* case when milestraveled < 10000 then 1.5 when milestraveled >= 10000 then 2 else 1 end;

    • C. 

      proc sql; update work.frequentflyers set pointsearned=pointsearned* case if milestraveled < 10000 then pointsearned*1.5 if milestraveled >= 10000 then pointsearned*2 else 1 end;

    • D. 

      proc sql; update work.frequentflyers set pointsearned=pointsearned* case if milestraveled < 10000 then pointsearned*1.5 if milestraveled >= 10000 then pointsearned*2 else pointsearned*1 end;

  • 7. 
    Which of the following statements is used to add new rows to a table?
    • A. 

      INSERT

    • B. 

      LOAD

    • C. 

      VALUES

    • D. 

      CREATE TABLE

  • 8. 
    Which of the following statements regarding the ALTER TABLE statement is false?
    • A. 

      It allows you to update column attributes.

    • B. 

      It allows you to add new columns in your table.

    • C. 

      It allows you to drop columns in your table.

    • D. 

      It allows you to change a character column to a numeric column.

  • 9. 
    Which of the following displays the structure of a table in the SAS log?
    • A. 

      proc sql; describe as select * from sasuser.payrollmaster;

    • B. 

      proc sql; describe contents sasuser.payrollmaster;

    • C. 

      proc sql; describe table sasuser.payrollmaster;

    • D. 

      proc sql; describe * from sasuser.payrollmaster;

  • 10. 
    Which of the following creates an empty table that contains the 2 columns FullName and Age?
    • A. 

      proc sql; create table work.names (FullName char(25), Age num);

    • B. 

      proc sql; create table work.names as (FullName char(25), Age num);

    • C. 

      proc sql; create work.names (FullName char(25), Age num);

    • D. 

      proc sql; create table work.names set (FullName char(25), Age num);

Related Topics
Back to Top Back to top