Chapter 1 Introduction to SAS

Document Sample
Chapter 1 Introduction to SAS Powered By Docstoc
					Using SAS Dictionary Tables to Build Metadata

definitionDataDetail fieldID dataKeyID variableName variableLabel variableType variableLength variableFormat

bridgeProgramData programID dataKeyID

DefinitionProgram programID program information fields

definitionData dataKeyID dataName dataType dataLibrary dataLabel

DataUsage

Other Meta Data Tables programID

1

Using SAS Dictionary Tables to Build Metadata
SASHELP.VTABLE Variable libname Description Library reference

memname
memlabel memtype

Dataset member name
Dataset label Dataset type (data, view, etc.)

2

Using SAS Dictionary Tables to Build Metadata
SASHELP.VCOLUMN Variable libname memname Description Library reference Dataset member name

name label
type length informat format

Variable name Variable label
Variable type (num or char) Variable length Variable informat Variable format

3

Using SAS Dictionary Tables to Build Metadata
• Select data from the Dictionary view SASHELP.VTABLE to use in populating the metadata table definitionData proc sql; create table tableinfo as select libname , memname , memlabel , memtype from sashelp.vtable where libname = 'SASUSER'; quit; proc print data=tableinfo; title 'Display of table information selected from SASHELP.VTABLE'; run;

4

Using SAS Dictionary Tables to Build Metadata
Display of table information selected from SASHELP.VTABLE libname SASUSER SASUSER memname SOFTSALE SOFTSALE memlabel Softsale Employee Sales Data memtype DATA AUDIT

5

Using SAS Dictionary Tables to Build Metadata
• Select data from the Dictionary view SASHELP.VCOLUMN to use in populating the metadata table definitionDataDetail proc sql; create table columninfo as select libname , memname , name , label , type , length , informat , format from sashelp.vcolumn where libname = 'SASUSER'; quit;

proc print data=columninfo; title 'Display of column information selected from SASHELP.VCOLUMN'; run;
6

Using SAS Dictionary Tables to Build Metadata
Display of column information selected from SASHELP.VCOLUMN libname memname SASUSER SASUSER SASUSER SASUSER SASUSER SASUSER SASUSER SASUSER SASUSER SASUSER SASUSER SASUSER SASUSER SASUSER SASUSER SASUSER SASUSER SASUSER SASUSER SOFTSALE SOFTSALE SOFTSALE SOFTSALE SOFTSALE SOFTSALE SOFTSALE SOFTSALE SOFTSALE SOFTSALE SOFTSALE SOFTSALE SOFTSALE SOFTSALE SOFTSALE SOFTSALE SOFTSALE SOFTSALE SOFTSALE name Name Division Years Sales Expense State Name Division Years Sales Expense State reasonCode _ATDATETIME_ _ATOBSNO_ _ATRETURNCODE_ _ATUSERID_ _ATOPCODE_ _ATMESSAGE_ label Employee Name Employee Division Years of Service Weekly Sales Weekly Expenses Sales Territory Employee Name Employee Division Years of Service Weekly Sales Weekly Expenses Sales Territory type length informat format char char num num num char char char num num num char char num num num char char char 10 1 8 8 8 2 10 1 8 8 8 2 10 8 8 8 32 2 8 $10. F7.2 F7.2 $10. $10. $1. F2. DOLLAR9.2 DOLLAR9.2 $2. $10. $1. F2. DOLLAR9.2 DOLLAR9.2 $2. DATETIME19.

F7.2 F7.2

7