<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Querying Metadata using Proc Metadata in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Querying-Metadata-using-Proc-Metadata/m-p/556434#M155008</link>
    <description>&lt;P&gt;And what does your LOG show? You might want to post the log starting with the first filename statement.&lt;/P&gt;
&lt;P&gt;Copy and paste into a code box opened with the forum's {I} or "running man" icon.&lt;/P&gt;</description>
    <pubDate>Mon, 06 May 2019 14:29:13 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-05-06T14:29:13Z</dc:date>
    <item>
      <title>Querying Metadata using Proc Metadata</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Querying-Metadata-using-Proc-Metadata/m-p/556349#M154990</link>
      <description>&lt;P&gt;Hi Everyone.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am attempting to query metadata using Proc Metadata and am having some problems.&amp;nbsp; I got the base query from&amp;nbsp;&lt;A href="https://support.sas.com/documentation/cdl/en/lrmeta/60739/HTML/default/viewer.htm#a003177416.htm" target="_self"&gt;https://support.sas.com/documentation/cdl/en/lrmeta/60739/HTML/default/viewer.htm#a003177416.htm&lt;/A&gt;&amp;nbsp;(which works perfectly and seems to make sense when I compare the map and the query to the Metadata Browser) and am attempting to modify it to suit my needs.&amp;nbsp; Initially I am attempting to get the name of all jobs registered in Metadata, then identify those which are deployed and lastly which flows the jobs are part of.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I execute the following query the resulting table contains no data.&amp;nbsp; Can anyone help get me back on track please?&amp;nbsp; I have read all the documentation and it doesn't seem to help.&amp;nbsp; I have also read a number of whitepapers, however converting the logic they are using to fit my use case is problematic.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any assistance is greatly appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Scott&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Assign filerefs and libref. */
filename query "&amp;amp;datapath.\results2.xml" lrecl=256;
filename rawdata "&amp;amp;datapath.\results3.xml" lrecl=256; 
filename map temp; 
libname myxml xml xmlfileref=rawdata xmlmap=map;

/* Create temporary query file.                           */
/* 2309 flag plus template gets table name, column name,  */
/* engine, libref, and object IDs. The template specifies */
/* attributes of the nested objects.                      */

data _null_;
   file query;
   input;
   put _infile_;
   datalines;
&amp;lt;GetMetadataObjects&amp;gt;
   &amp;lt;Reposid&amp;gt;$METAREPOSITORY&amp;lt;/Reposid&amp;gt;
   &amp;lt;Type&amp;gt;Job&amp;lt;/Type&amp;gt;
   &amp;lt;Objects/&amp;gt;
   &amp;lt;Ns&amp;gt;SAS&amp;lt;/Ns&amp;gt;
   &amp;lt;Flags&amp;gt;2309&amp;lt;/Flags&amp;gt;
   &amp;lt;Options&amp;gt;
    &amp;lt;Templates&amp;gt;
      &amp;lt;Job/&amp;gt;
        &amp;lt;Column Name=""/&amp;gt;
    &amp;lt;/Templates&amp;gt;
   &amp;lt;/Options&amp;gt;

&amp;lt;/GetMetadataObjects&amp;gt;
;;
run;

proc metadata
     in=query
     out=rawdata;
run;


data _null_;
   file map;
   input;
   put _infile_;
   datalines;

&amp;lt;?xml version="1.0" ?&amp;gt;
  &amp;lt;SXLEMAP version="1.2"&amp;gt;

   &amp;lt;TABLE name="JobDetails"&amp;gt; 
   &amp;lt;TABLE-PATH syntax="xpath"&amp;gt;
     /GetMetadataObjects/Objects/Job/
   &amp;lt;/TABLE-PATH&amp;gt;

   &amp;lt;COLUMN name="Name" retain="yes"&amp;gt;
     &amp;lt;PATH&amp;gt;
     	/GetMetadataObjects/Objects/Job/
     &amp;lt;/PATH&amp;gt;
     &amp;lt;TYPE&amp;gt;character&amp;lt;/TYPE&amp;gt;
     &amp;lt;DATATYPE&amp;gt;STRING&amp;lt;/DATATYPE&amp;gt;
     &amp;lt;LENGTH&amp;gt;60&amp;lt;/LENGTH&amp;gt;
   &amp;lt;/COLUMN&amp;gt;
   &amp;lt;/TABLE&amp;gt;
   
&amp;lt;/SXLEMAP&amp;gt;
;
Run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2019 04:57:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Querying-Metadata-using-Proc-Metadata/m-p/556349#M154990</guid>
      <dc:creator>Scott_Mitchell</dc:creator>
      <dc:date>2019-05-06T04:57:37Z</dc:date>
    </item>
    <item>
      <title>Re: Querying Metadata using Proc Metadata</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Querying-Metadata-using-Proc-Metadata/m-p/556434#M155008</link>
      <description>&lt;P&gt;And what does your LOG show? You might want to post the log starting with the first filename statement.&lt;/P&gt;
&lt;P&gt;Copy and paste into a code box opened with the forum's {I} or "running man" icon.&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2019 14:29:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Querying-Metadata-using-Proc-Metadata/m-p/556434#M155008</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-05-06T14:29:13Z</dc:date>
    </item>
    <item>
      <title>Re: Querying Metadata using Proc Metadata</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Querying-Metadata-using-Proc-Metadata/m-p/556604#M155056</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;22         /* Assign filerefs and libref. */
23         filename query "&amp;amp;datapath.\results2.xml" lrecl=256;
24         filename rawdata "&amp;amp;datapath.\results3.xml" lrecl=256;
25         filename map temp;
26         libname myxml xml xmlfileref=rawdata xmlmap=map;
NOTE: Libref MYXML was successfully assigned as follows: 
      Engine:        XML 
      Physical Name: 
27         
28         /* Create temporary query file.                           */
29         /* 2309 flag plus template gets table name, column name,  */
30         /* engine, libref, and object IDs. The template specifies */
31         /* attributes of the nested objects.                      */
32         
33         data _null_;
34            file query;
35            input;
36            put _infile_;
37            datalines;

NOTE: The file QUERY is:
      Filename=\\SASVM\SAS-DATA\LEV1\DATA\USER SANDPITS\SMLL\CLH SAS FORUM\DATA\results2.xml,
      RECFM=V,LRECL=256,File Size (bytes)=0,
      Last Modified=07 May 2019 08:29:12,
      Create Time=06 May 2019 13:50:53

NOTE: 14 records were written to the file QUERY.
      The minimum record length was 80.
      The maximum record length was 80.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      
52         ;;

53         run;
2                                                          The SAS System                                 08:26 Tuesday, May 7, 2019

54         
55         proc metadata
56              in=query
57              out=rawdata;
58         run;

NOTE: PROCEDURE METADATA used (Total process time):
      real time           2.68 seconds
      cpu time            0.09 seconds
      

59         
60         
61         data _null_;
62            file map;
63            input;
64            put _infile_;
65            datalines;

NOTE: The file MAP is:
      Filename=F:\SAS\Lev1\SASWORK\_TD10044_SASVM_\#LN00282,
      RECFM=V,LRECL=32767,File Size (bytes)=0,
      Last Modified=07 May 2019 08:29:14,
      Create Time=07 May 2019 08:29:14

NOTE: 20 records were written to the file MAP.
      The minimum record length was 80.
      The maximum record length was 80.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      
86         ;

87         Run;
88         &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;Log added as requested.&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2019 22:30:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Querying-Metadata-using-Proc-Metadata/m-p/556604#M155056</guid>
      <dc:creator>Scott_Mitchell</dc:creator>
      <dc:date>2019-05-06T22:30:17Z</dc:date>
    </item>
  </channel>
</rss>

