Introduction to the Metadata LIBNAME Engine |
Each option is constructed from the PropertyName, Delimiter, DefaultValue, and UseValueOnly attributes in a Property object. The default option values are represented by one or more Property objects. These Property objects are associated directly with an owning object (a SASLibrary, SASClientConnection, or PhysicalTable object).
To provide users with a different set of values from the default option values, an administrator can group one or more Property objects by using a PropertySet object. If you do not want the default options, use the LIBOPTSET= or CONOPTSET= argument, or the OPTSET= data set option to specify a PropertySet object. One or more PropertySet objects can be associated with an owning object.
However, only the default options or one PropertySet object can be used with an owning object at one time. For more information about the metadata objects, see Property and PropertySet.
Because some options do not take delimiters and a value, the UseValueOnly attribute specifies whether to use the DefaultValue only, or to precede it with the PropertyName and Delimiter. Notice in the examples when UseValueOnly is set to 0, and when it is set to 1. See Examples: CONOPTSET= or LIBOPTSET= Argument and Examples: OPTSET= Data Set Option.
See also Example: Creating a PropertySet Object for Use with LIBOPTSET=.
Examples: CONOPTSET= or LIBOPTSET= Argument |
This example shows how the metadata engine constructs a LIBNAME statement for the underlying engine. In particular, the example illustrates how option values are obtained from metadata objects.
In this example, the user assigns a libref to a SASLibrary object that has the unique identifier AD000001. This object represents the physical SAS library. The metadata engine uses the SASLibrary object AD000001 to obtain all of the necessary values to construct a LIBNAME statement for the underlying engine (in this case, the V9 engine).
The following table shows how the option values (for the underlying engine) are obtained from the attributes of metadata objects.
Metadata Object | Relevant Object Attributes | Language Element | Value |
---|---|---|---|
SASLibrary (unique identifier = AD000001) | Libref='sas9' | libref | SAS9 |
SASLibrary (same object as above) | Engine='V9' | engine | V9 |
Directory |
DirectoryName='sales'
IsRelative='1' |
'SAS-data-library' | sales |
Directory (parent to above Directory object) |
DirectoryName='C:\'
IsRelative='0' |
'SAS-data-library' | C:\ |
Property |
PropertyName='repempty'
Delimiter='=' DefaultValue='no' UseValueOnly='0' |
option | REPEMPTY=NO |
Property |
PropertyName='access'
Delimiter='=' DefaultValue='readonly' UseValueOnly='0' |
option | ACCESS=READONLY |
Property |
DefaultValue='nodltrunchk'
UseValueOnly='1' |
option | NODLTRUNCHK |
Property |
DefaultValue='extend'
UseValueOnly='1' |
option | EXTEND |
PropertySet | Name='basetrun' | group of options | LIBOPTSET=BASETRUN |
With the metadata already registered in a repository, the user submits the following metadata LIBNAME statement to SAS:
libname mytest meta libid=AD000001 repname=sasrepos ipaddr='a123.us.company.com' port=8561 userid=sasabc pw=srvpw;
The metadata engine constructs the following LIBNAME statement for the V9 engine:
libname sas9 v9 'C:\sales' repempty=no access=readonly nodltrunchk extend;
The next example illustrates the use of a PropertySet object with the LIBOPTSET argument. The following table shows the option values that are represented by a PropertySet object named BASETRUN, which groups several Property objects. Three of the option values are identical to the default option values for the data library. One value, the z/OS option DLTRUNCHK, is different from the default option value.
SAS Option | PropertyName Attribute | Delimiter Attribute | DefaultValue Attribute | UseValueOnly Attribute |
---|---|---|---|---|
REPEMTY=NO | REPEMPTY | = | NO | 0 |
ACCESS=READONLY | ACCESS | = | READONLY | 0 |
NODLTRUNCHK |
|
|
DLTRUNCHK | 1 |
EXTEND |
|
|
EXTEND | 1 |
With the metadata already registered in a repository, the user submits the following metadata LIBNAME statement to SAS:
libname mytest meta libid=AD000001 repname=sasrepos ipaddr='a123.us.company.com' port=8561 userid=sasabc pw=srvpw liboptset=basetrun;
The metadata engine constructs a LIBNAME statement as in the previous example, but with the DLTRUNCHK option instead of the default option:
libname sas9 v9 'C:\sales' repempty=no access=readonly dltrunchk extend;
Examples: OPTSET= Data Set Option |
Here are some examples with and without the OPTSET= data set option:
In the following PRINT procedure, the metadata engine uses the SAS/ACCESS Interface to Oracle engine as its underlying engine. No options are specified in the PROC PRINT statement, and no OPTSET= value is specified. Therefore, this PROC PRINT uses the default options. The default option values are obtained from Property objects that are associated with the PhysicalTable object.
proc print data=x.dept; run;
The next PROC PRINT uses the SAS/ACCESS Interface to Oracle engine. Options are specified in the PROC PRINT statement, so they take precedence over option values in the metadata.
proc print data=oralib.dept (dbnull=(empid=no jobcode=no)); run;
In the next PROC PRINT, option values are obtained from the NULLSET PropertySet object:
proc print data=x.dept (optset=nullset); run;
In the next procedure, option values are obtained from the OPTS2 PropertySet object:
proc append base=work.sasbig data=mymeta.bigtable (optset='opts2'); run;
In this DATA step, option values are obtained from the DS1 PropertySet object:
data a; set x.b(optset=ds1); run;
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.