Dictionary Tables and Views, obtain information about SAS files

Slides:



Advertisements
Similar presentations
EBSCO Discovery Service
Advertisements

Creating Tables. 2 home back first prev next last What Will I Learn? List and provide an example of each of the number, character, and date data types.
Chapter 9: Introducing Macro Variables 1 © Spring 2012 Imelda Go, John Grego, Jennifer Lasecki and the University of South Carolina.
Managing Processing Using PROC SQL Chapter 8 1 Imelda Go, John Grego, Jennifer Lasecki, 2011.
Statistics in Science  Introducing SAS ® software Acknowlegements to David Williams Caroline Brophy.
ERWin Template Overview By: Dave Wentzel. Agenda u Overview of Templates/Macros u Template editor u Available templates u Independent column browser u.
SAS Programming Techniques for Decoding Variables on the Database Level By Chris Speck PAREXEL International RTSUG – Wednesday, March 23, 2011.
Using Objects and Properties
Concepts of Database Management Sixth Edition
© Pearson Education Limited, Chapter 12 Physical Database Design – Step 3 (Translate Logical Design) Transparencies.
Chapter 18: Modifying SAS Data Sets and Tracking Changes 1 STAT 541 ©Spring 2012 Imelda Go, John Grego, Jennifer Lasecki and the University of South Carolina.
SAS® Explorer Use and Customization Richard A. DeVenezia.
SAS Workshop Lecture 1 Lecturer: Annie N. Simpson, MSc.
11 Chapter 3: Reading and Processing Data 3.1 Processing SAS Data Sets 3.2 Processing External Files.
Chapter 4 The Relational Model 3: Advanced Topics Concepts of Database Management Seventh Edition.
Database Programming Sections 13–Creating, revoking objects privileges.
Chapter 8: Additional PROC SQL Features
PROC SQL: Tips and Translations for Data Step Users By: Gail Jorgensen Susan Marcella.
Controlling User Access. Objectives After completing this lesson, you should be able to do the following: Create users Create roles to ease setup and.
Oracle 11g: SQL Chapter 4 Constraints.
Chapter 4 Constraints Oracle 10g: SQL. Oracle 10g: SQL 2 Objectives Explain the purpose of constraints in a table Distinguish among PRIMARY KEY, FOREIGN.
Performing Advanced Queries Using PROC SQL Chapter 2 1.
IT Faculty Software Engineering Seniors UML for a simple DataBase Management System Prepared by: أنس الأسود بشير الفروان زهير الزعبي ياسر المحمد.
Session 1 Module 1: Introduction to Data Integrity
Instructor: Pavlos Pavlikas1 How Data is Stored Chapter 8.
Copyright © 2004, SAS Institute Inc. All rights reserved. SASHELP Datasets A real life example Barb Crowther SAS Consultant October 22, 2004.
1 Checking Data with the PRINT and FREQ Procedures.
Using Dictionary Tables to Profile SAS Datasets By Phillip Julian February 11, 2011.
HRP Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected by copyright law and.
Based on Learning SAS by Example: A Programmer’s Guide Chapters 1 & 2
Online Programming| Online Training| Real Time Projects | Certifications |Online Classes| Corporate Training |Jobs| CONTACT US: STANSYS SOFTWARE SOLUTIONS.
SAS Certification Prep Guide Chapter 7 Creating and Applying User-Defined Formats.
Better Metadata Through SAS® II: %SYSFUNC, PROC DATASETS, and Dictionary Tables.
Beautiful PROC CONTENTS Output Using the ODS Excel Destination Suzanne Dorinski SESUG 2015 Disclaimer: Any views expressed are those of the author and.
Data Integrity & Indexes / Session 1/ 1 of 37 Session 1 Module 1: Introduction to Data Integrity Module 2: Introduction to Indexes.
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 3 & 4 By Tasha Chapman, Oregon Health Authority.
Session 1 Retrieving Data From a Single Table
Chapter 10: Accessing Relational Databases (Self-Study)
Controlling User Access
Temporary vs. Permanent SAS Data Sets
TABLES AND INDEXES Ashima Wadhwa.
Data Resource Management
The System Catalog Describing the Data Copyright © Curt Hill
Basic Queries Specifying Columns
PROC SQL, Overview.
An Introduction to SQL.
Some ways to encourage quality programming
Creating Macro Variables in SQL (Review)
Chapter 18: Modifying SAS Data Sets and Tracking Changes
3 Macro Storage.
Instructor: Raul Cruz-Cano
Fall 2017 Questions and Answers (Q&A)
Integrity Constraints
Displaying Queries 2 Display a query’s results in a specified order.
Beautiful PROC CONTENTS Output Using the ODS Excel Destination
Defining and Calling a Macro
Global and Local Symbol Tables
How to Create Data Driven Lists
3 Iterative Processing.
Business Application Development
Lisa Mendez, PhD & Andrew Kuligowski
Program Testing and Performance
3 Parameter Validation.
Never Cut and Paste Again
Setting SQL Procedure Options
3 Views.
A new keyword -- calculated
a useful SAS 9.2 feature I wasn’t aware of *
Data tmp; do i=1 to 10; output; end; run; proc print data=tmp;
Frank DiIorio CodeCrafters, Inc. Philadelphia PA
Presentation transcript:

Dictionary Tables and Views, obtain information about SAS files 4 Dictionary Tables and Views, obtain information about SAS files

Dictionary Tables: Overview Dictionary tables are read-only SAS views that contain session metadata, such as information about SAS libraries, data sets, and external files in use or available in the current SAS session. Created at SAS session initialization Updated automatically by SAS Limited to read-only access. You can query dictionary tables with PROC SQL.

Dictionary Tables: Overview The metadata available in dictionary tables includes information about : SAS data sets and other SAS files available in SAS libraries Any allocated external files SAS session metadata: System option names and settings Macro variable names and values Title text Footnote text

proc sql; describe table dictionary.dictionaries; reset outobs=1; select * from dictionary.dictionaries; reset outobs=; describe table dictionary.libnames; select libname from dictionary.libnames; describe table dictionary.tables; select memname from dictionary.tables where libname="NH9"; quit;

Metadata about SAS Libraries DICTIONARY.LIBNAMES general information about SAS libraries DICTIONARY.MEMBERS general information about SAS library members DICTIONARY.TABLES detailed information about tables DICTIONARY.VIEWS detailed information about all data views DICTIONARY.CATALOGS information about catalog entries DICTIONARY.COLUMNS detailed information about all columns in all tables continued...

Metadata about Indexes and Constraints DICTIONARY.INDEXES indexes defined for tables DICTIONARY.TABLE_CONSTRAINTS integrity constraints in all tables DICTIONARY.CHECK_CONSTRAINTS check constraints in all tables DICTIONARY.REFERENTIAL_CONSTRAINTS referential constraints in all tables DICTIONARY.CONSTRAINT_COLUMN_USAGE columns that are referenced by integrity constraints DICTIONARY.CONSTRAINT_TABLE_USAGE tables that use integrity constraints continued...

Metadata about the SAS Session DICTIONARY.MACROS macro variables names and values DICTIONARY.OPTIONS current settings of SAS system options DICTIONARY.TITLES text currently assigned to titles and footnotes DICTIONARY.EXTFILES currently assigned filerefs

proc sql; select * from dictionary.libnames; quit;

Exploring Dictionary Information proc sql; select memname,nobs,nvar,crdate from dictionary.tables where libname='ORION'; quit; Library names are stored in uppercase in dictionary tables.

Exploring Dictionary Information proc sql; select Name,Type,Length from dictionary.columns where libname='ORION' and memname='EMPLOYEE_ADDRESSES' ; quit; Table names (memnames) are also stored in uppercase in dictionary tables.

Using Dictionary Information, Which tables contain the Employee_ID column? proc sql; select memname, name from dictionary.columns where libname='ORION' and upcase(name)='EMPLOYEE_ID'; quit; Because different tables might use different cases for same-named columns, you can use the UPCASE function for comparisons, but this significantly degrades the performance of the query.

Dictionary Information in Other SAS Processes To use dictionary table metadata in other procedures or in a DATA step: use the SAS-provided views based on the dictionary tables in the Sashelp library create a PROC SQL view based on a dictionary table Most of the Sashelp library metadata view names are similar to dictionary table names, but are shortened to eight characters or less. They begin with the letter v and do not end in s. For example: dictionary.tables = sashelp.vtable

proc contents data=sashelp.vtable;run; proc print data=sashelp.vtable(obs=5); where libname="ORION"; run;

proc sql; select memname, name from dictionary.columns where libname="FRAM" and upcase(name) contains upcase("chol"); quit;

proc sql; select memname, name from dictionary.columns where libname="FRAM" and upcase(label) contains upcase("chol"); quit;