The following method
call shows another way to format an AddMetadata request that creates
multiple objects. The request creates a second table object, named
Sales Associates, and creates objects representing the table's columns
by stacking their metadata property strings. A Column object cannot
be created without an association to a table object. Therefore, a
symbolic name is assigned to the PhysicalTable object to enable the
Column objects to reference the PhysicalTable object before it is
created.
<AddMetadata>
<Metadata>
<PhysicalTable Id="$Employees" Name="Sales Associates"
Desc="Sales associates in NW region" PublicType="Table">
<TablePackages>
<SASLibrary ObjRef="A53TPPVI.A1000001"/>
</TablePackages>
</PhysicalTable>
<Column
Name="Name"
Desc="Name of employee"
ColumnName="Employee_Name"
SASColumnName="Employee"
ColumnType="12"
SASColumnType="C"
ColumnLength="32"
SASColumnLength="32"
SASFormat="$Char32."
SASInformat="$32."
PublicType="Column" >
<Table>
<PhysicalTable ObjRef="$Employees"/>
</Table>
</Column>
<Column
Name="Address"
Desc="Home Address"
ColumnName="Employee_Address"
SASColumnName="Home_Address"
ColumnType="12"
SASColumnType="C"
ColumnLength="32"
SASColumnLength="32"
SASFormat="$Char32."
SASInformat="$32."
PublicType="Column">
<Table>
<PhysicalTable ObjRef="$Employees"/>
</Table>
</Column>
<Column
Name="Title"
Desc="Job grade"
ColumnName="Title"
SASColumnName="Title"
ColumnType="12"
SASColumnType="C"
ColumnLength="32"
SASColumnLength="32"
SASFormat="$Char32."
SASInformat="$32."
PublicType="Column">
<Table>
<PhysicalTable ObjRef="$Employees"/>
</Table>
</Column>
</Metadata>
<Reposid>A0000001.A53TPPVI</Reposid>
<NS>SAS</NS>
<Flags>268435456</Flags>
<Options/>
</AddMetadata>
In this method call,
the <REPOSID>, <NS>, and <FLAGS> elements contain
the same values as in Example of an AddMetadata Request That Creates a SAS Metadata Model Object. In the <METADATA> element,
note the following:
-
There are multiple metadata property
strings, stacked one on top of the other.
-
The metadata property string defining
the PhysicalTable object is the topmost string. This property string
includes an Id attribute that assigns the symbolic name $Employees.
Name and PublicType are required attributes.
-
Separate metadata property strings
define each Column object. Each string defines the unique attributes
of the column and the global Name and PublicType attributes.
-
Each Column definition defines
a Table association to the PhysicalTable object by specifying the
ObjRef attribute and referencing the symbolic name $Employees.
Here is an example of
the output returned by the SAS Metadata Server:
<!-- Using the ADDMETADATA method. -->
<PhysicalTable Id="A53TPPVI.A4000002" Name="Sales Associates"
Desc="Sales associates in NW region" PublicType="Table">
<TablePackages>
<SASLibrary ObjRef="A53TPPVI.A1000001"/>
</TablePackages>
</PhysicalTable>
<Column Name="Name" Desc="Name of employee" ColumnName="Employee_Name"
SASColumnName="Employee" ColumnType="12" SASColumnType="C" ColumnLength="32"
SASColumnLength="32" SASFormat="$Char32." SASInformat="$32." PublicType="Column"
Id="A53TPPVI.A5000005">
<Table>
<PhysicalTable ObjRef="A53TPPVI.A4000002"/>
</Table>
</Column>
<Column Name="Address" Desc="Home Address" ColumnName="Employee_Address"
SASColumnName="Home_Address" ColumnType="12" SASColumnType="C" ColumnLength="32"
SASColumnLength="32" SASFormat="$Char32." SASInformat="$32."
PublicType="Column" Id="A53TPPVI.A5000006">
<Table>
<PhysicalTable ObjRef="A53TPPVI.A4000002"/>
</Table>
</Column>
<Column Name="Title" Desc="Job grade" ColumnName="Title" SASColumnName="Title"
ColumnType="12" SASColumnType="C" ColumnLength="32" SASColumnLength="32"
SASFormat="$Char32." SASInformat="$32." PublicType="Column" Id="A53TPPVI.A5000007">
<Table>
<PhysicalTable ObjRef="A53TPPVI.A4000002"/>
</Table>
</Column>
The symbolic name is
replaced with the PhysicalTable object's unique object identifier
in the output everywhere that it was used.