1 / 13

Getting your metadata using PROC METADATA

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.

zoe-diaz
Download Presentation

Getting your metadata using PROC METADATA

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Getting your metadata using PROC METADATA Edwin J. van Stein Astellas Pharma Global Development Europe

  2. Contents Example of using PROC METADATA to get group memberships for a specific user from metadata

  3. 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";

  4. 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="

  5. Setting output arguments • Write output to file reference created earlier • Output XML to contain a full header out=outgroups header=full

  6. 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>

  7. 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>

  8. 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>

  9. 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>'

  10. Putting it all together proc 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;

  11. The XML output (partial)

  12. Next steps • Explore metadata using 257 as Flag and only setting Type • Conversion to data set using an XML map • Update metadata

  13. Questions nl.linkedin.com/in/ejvanstein ejvanstein@gmail.com

More Related