Chapter 7: Creating and Managing Views Using PROC SQL

  1. Correct answer: a
    A PROC SQL view accesses the most current underlying data and can be joined with tables or other views. In addition, a PROC SQL view can
    • be used in SAS programs in place of an actual SAS data file
    • be derived from one or more tables, PROC SQL views, or DATA step views.
  2. Correct answer: d
    PROC SQL views are useful because they
    • often save space (a view is usually quite small compared with the data that it accesses)
    • prevent users from continually submitting queries to omit unwanted columns or rows
    • hide complex joins or queries from users.
    In addition, PROC SQL views
    • ensure that input data sets are always current, because data is derived from tables at execution time
    • can be used to shield sensitive or confidential columns from users while enabling the same users to view other columns in the same table.
  3. Correct answer: c
    You use the CREATE VIEW statement to create a view. The keywords CREATE VIEW are followed by the name of the view and the keyword AS.
  4. Correct answer: b
    The DESCRIBE VIEW statement displays the view definition in the SAS log.
  5. Correct answer: a
    A view can be used in a PROC SQL step just as you would use an actual SAS table.
  6. Correct answer: d
    The USING clause enables you to embed a LIBNAME statement in your view definition. The USING clause must be the last clause in the CREATE VIEW statement.
  7. Correct answer: d
    PROC SQL views can access data from a SAS data file, a DATA step view, a PROC SQL view, or a relational database table.
  8. Correct answer: d
    When you are working with PROC SQL views, it is best to
    • avoid using an ORDER BY clause in a view. If you specify an ORDER BY clause, the data must be sorted each time the view is referenced.
    • avoid creating views that are based on tables whose structure might change. A view is no longer valid when it references a nonexistent column.
    • specify a one-level name in the FROM clause if the view resides in the same SAS data library as the contributing table(s). Using a one-level name in the FROM clause prevents you from having to change the view if you assign a different libref to the SAS data library that contains the view and its contributing table or tables.
  9. Correct answer: c
    You can update a PROC SQL view provided that the view does not join or link to another table, the view does not have a subquery, or you try to update a derived column. You can update a view that contains a WHERE clause. The WHERE clause can be in the UPDATE clause or in the view. You cannot update a view that contains any other clause such as an ORDER BY or a HAVING clause.
  10. Correct answer: b
    The DROP VIEW statement drops a view from the specified library.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.69.157