Chapter 4: Combining Tables Vertically Using Proc SQL

10 Questions | Total Attempts: 109

SettingsSettingsSettings
Please wait...
SQL Quizzes & Trivia

Practice for the SAS advance certification exam


Questions and Answers
  • 1. 
    Which statement is false with respect to a set operation that uses the EXCEPT, UNION, or INTERSECT set operator without a keyword?
    • A. 

      Column names in the result set are determined by the first table.

    • B. 

      To be overlaid, columns must be of the same data type.

    • C. 

      To be overlaid, columns must have the same name.

    • D. 

      By default, only unique rows are displayed in the result set.

  • 2. 
    The keyword ALL cannot be used with which of the following set operators?
    • A. 

      EXCEPT

    • B. 

      INTERSECT

    • C. 

      UNION

    • D. 

      OUTER UNION

  • 3. 
    Which PROC SQL step combines the tables Summer and Winter to produce the output displayed below?
    • A. 

      proc sql; select * from summer intersect all select * from winter;

    • B. 

      proc sql; select * from summer outer union select * from winter;

    • C. 

      proc sql; select * from summer union corr select * from winter;

    • D. 

      proc sql; select * from summer union select * from winter;

  • 4. 
    Which PROC SQL step combines tables but does not overlay any columns?
    • A. 

      proc sql; select * from groupa outer union select * from groupb;

    • B. 

      proc sql; select * from groupa as a outer union corr select * from groupb as b;

    • C. 

      proc sql; select coalesce(a.obs, b.obs) label='Obs', med, duration from groupa as a full join groupb as b on a.obs=b.obs;

    • D. 

      proc sql; select * from groupa as a intersect select * from groupb as b;

  • 5. 
    Which statement is false regarding the keyword CORRESPONDING?
    • A. 

      It cannot be used with the keyword ALL.

    • B. 

      It overlays columns by name, not by position.

    • C. 

      When used in EXCEPT, INTERSECT, and UNION set operations, it removes any columns not found in both tables.

    • D. 

      When used in OUTER UNION set operations, it causes same-named columns to be overlaid.

  • 6. 
    Which PROC SQL step generates the following output from the tables Dogs and Pets?
    • A. 

      proc sql; select name, price from pets except all select * from dogs;

    • B. 

      proc sql; select name, price from pets except select * from dogs;

    • C. 

      proc sql; select name, price from pets except corr all select * from dogs;

    • D. 

      proc sql; select * from dogs except corr select name, price from pets;

  • 7. 
    The PROG1 and PROG2 tables list students who took the PROG1 and PROG2 courses, respectively. Which PROC SQL step will give you the names of the students who took only the PROG1 class?
    • A. 

      proc sql; select fname, lname from prog1 intersect select fname, lname from prog2;

    • B. 

      proc sql; select fname, lname from prog1 except all select fname, lname from prog2;

    • C. 

      proc sql; select * from prog2 intersect corr select * from prog1;

    • D. 

      proc sql; select * from prog2 union select * from prog1;

  • 8. 
    Which PROC SQL step will return the names of all the students who took PROG1, PROG2, or both classes?
    • A. 

      proc sql; select fname, lname from prog1 intersect select fname, lname from prog2;

    • B. 

      proc sql; select fname, lname from prog1 outer union corr select fname, lname from prog2;

    • C. 

      roc sql; select fname, lname from prog1 union select fname, lname from prog2;

    • D. 

      proc sql; select fname, lname from prog1 except corr select fname, lname from prog2;

  • 9. 
    Which PROC SQL step will return the names of all the students who took both the PROG1 and PROG2 classes?
    • A. 

      proc sql; select fname, lname from prog1 union select fname, lname from prog2;

    • B. 

      proc sql; select fname, lname from prog1 except corr select fname, lname from prog2;

    • C. 

      proc sql; select fname, lname from prog1 intersect all select fname, lname from prog2;

    • D. 

      proc sql; select fname, lname from prog1 union corr select fname, lname from prog2;

  • 10. 
    Which PROC SQL step will generate the same results as the following DATA step?
    • A. 

      proc sql; select fname, lname from prog1 outer union corr select fname, lname from prog2 order by lname;

    • B. 

      proc sql; select fname, lname from prog1 union select fname, lname from prog2 order by lname;

    • C. 

      proc sql; select fname, lname from prog2 outer union select fname, lname from prog1 order by lname;

    • D. 

      proc sql; select fname, lname from prog2 union corr select fname, lname from prog1 order by lname;

Related Topics
Back to Top Back to top