View
80
Download
0
Category
Preview:
DESCRIPTION
Getting your metadata using PROC METADATA. Edwin J. van Stein Astellas Pharma Global Development Europe. Contents. Example of using PROC METADATA to get group memberships for a specific user from metadata. Preparing for output. - PowerPoint PPT Presentation
Citation preview
Getting your metadata Getting your metadata using PROC METADATAusing PROC METADATA
Edwin J. van SteinAstellas Pharma Global Development Europe
Contents
Example of using PROC METADATA to get group memberships for a specific user from metadata
Preparing for output
Output written to physical XML file to later convert to SAS data set
Encoding of XML file specified to prevent problems with strange characters
filename outgroups
"/sas/user/test/groups.xml"
encoding="utf-8";
Setting server connection arguments
SERVER, PORT, USER, PASSWORD and PROTOCOL all default to corresponding system options if not specified
USER and PASSWORD (encoded with PROC PWENCODE) set to user with more rights
proc metadata userid="sasadm" password="{sas001}bXkgcGFzc3dvcmQ="
Setting output arguments
Write output to file reference created earlier
Output XML to contain a full header
out=outgroups
header=full
XML-formatted method call (1)
Tell the metadata server to get objects
From which repository to get objects
Type of objects to get
Specify namespace
in='<GetMetadataObjects>
<Reposid>$METAREPOSITORY</Reposid>
<Type>Person</Type>
<NS>SAS</NS>
XML-formatted method call (2) Set flags so that metadata server performs the correct
actions:
• Fill a pre-specified template (flag OMI_TEMPLATE=4)
• Use an XMLSelect element to filter metadata (flag OMI_XMLSELECT=128)
• Get the metadata found (flag OMI_GET_METADATA=256)
• Use XMLSelect element case-sensitive (flag OMI_MATCH_CASE=512)
<Flags>900</Flags>
XML-formatted method call (3) Both template and XMLSelect element need to be
within <Options> tags
Only want person and group names returned
<Options>
<Templates>
<Person Name="">
<IdentityGroups />
</Person>
<IdentityGroup Name=""/>
</Templates>
XML-formatted method call (4)
Only return data for persons with a specific name
Close open tags to finalize XML-formatted method call
<XMLSelect search="@Name=''Person 1''"/>
</Options>
</GetMetadataObjects>'
Putting it all togetherproc metadata userid="sasadm"
password="{sas001}bXkgcGFzc3dvcmQ="
out=outgroups
header=full
in='<GetMetadataObjects>
<Reposid>$METAREPOSITORY</Reposid>
<Type>Person</Type>
<NS>SAS</NS>
<Flags>900</Flags>
<Options>
<Templates>
<Person Name="">
<IdentityGroups />
</Person>
<IdentityGroup Name=""/>
</Templates>
<XMLSelect search="@Name=''Person 1''"/>
</Options>
</GetMetadataObjects>';
run;
The XML output (partial)
Next steps
Explore metadata using 257 as Flag and only setting Type
Conversion to data set using an XML map
Update metadata
Questions
nl.linkedin.com/in/ejvanstein
ejvanstein@gmail.com
Recommended