<?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: Getting all libraries from meta data in Administration and Deployment</title>
    <link>https://communities.sas.com/t5/Administration-and-Deployment/Getting-all-libraries-from-meta-data/m-p/720444#M21576</link>
    <description>&lt;P&gt;Thank you,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;&amp;nbsp; for the compliment &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/78975"&gt;@gwootton&lt;/a&gt;&amp;nbsp;, thank you for your suggestion.&lt;/P&gt;&lt;P&gt;The nucleus of the problem can be circumvented by using your suggested code snippet.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In general, I must admit, that I do not have the deep dive insights, yet, of the SAS Open Metadata Architecture.&lt;/P&gt;&lt;P&gt;For example, it would be very helpful to me, to know in general, which oms objects elements are available, like e.g.&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;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="sas"&gt;omsobj:SASLibrary&lt;/LI-CODE&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;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I guess, I have to study the&amp;nbsp;&lt;A title="SAS® 9.4 Metadata Model: Reference" href="https://support.sas.com/documentation/cdl/en/omamodref/67417/HTML/default/viewer.htm#titlepage.htm" target="_self"&gt;SAS® 9.4 Metadata Model: Reference&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;There, I can find the complete list of Meta Data Types, that can be queried:&lt;BR /&gt;&lt;A href="https://support.sas.com/documentation/cdl/en/omamodref/67417/HTML/default/viewer.htm#alphalist.htm" target="_self"&gt;https://support.sas.com/documentation/cdl/en/omamodref/67417/HTML/default/viewer.htm#alphalist.htm&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 19 Feb 2021 13:12:07 GMT</pubDate>
    <dc:creator>FK1</dc:creator>
    <dc:date>2021-02-19T13:12:07Z</dc:date>
    <item>
      <title>Getting all libraries from meta data</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Getting-all-libraries-from-meta-data/m-p/713329#M21560</link>
      <description>&lt;P&gt;&amp;nbsp;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I cannot grasp as of why I get two different results in the sense of number of libraries, when running theses two codes:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.list_with_116;
	keep name engine ;

	* Temp-Variablen;
	length uri_lib $256.;

	* Ausgabe-Variablen;
	length name $200.;
	length engine $32.;
	
	nobj=-1;
	n=1;

	*Foundation(Repository) &amp;gt; SASLibrary(Objekt);
	nobj = metadata_getnobj("omsobj:SASLibrary?@Id contains '.'", n, uri_lib);

	if nobj&amp;gt;0 then
		do;
			do i=1 to nobj;
				nobj2 = metadata_getnobj("omsobj:SASLibrary?@Id contains '.'", i, uri_lib);
				rc1 = metadata_getattr(uri_lib, "Name", name);
				rc2 = metadata_getattr(uri_lib, "Engine", engine);
					output;
			end;
		end;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and&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;data work.list_with_114;

length serveruri liburi upasnuri $256 Bibliotheksname ServerContext $128 type id $17 Libref Engine $8 Physischer_Pfad Datenkbankschema_Label Datenkbankschema_Name $256;

keep ServerContext Bibliotheksname Libref Engine Physischer_Pfad Datenkbankschema_Label Datenkbankschema_Name;

/*Initialisieren, damit keine Notes im Log auftauchen*/
call missing(serveruri, liburi, upasnuri, ServerContext, Bibliotheksname, Engine, Libref);

/*Mit "1" initialisieren, wird dann in der Schleife unten hochgezaehlt */
nlibobj=1;

/*librc = Anzahl der Bibliotheken die gefunden wurden*/
librc=metadata_getnobj("omsobj:SASLibrary?@Id contains '.'",nlibobj,liburi);

	do while (librc&amp;gt;0);
		rc=metadata_getattr(liburi,'Name',Bibliotheksname);
		rc=metadata_getattr(liburi,'Engine',Engine);
		rc=metadata_getattr(liburi,'Libref',Libref);


		n=1;
		uprc=metadata_getnasn(liburi,'UsingPackages',n,upasnuri);
		rc=metadata_getnasn(liburi, "DeployedComponents", n, serveruri);
		rc=metadata_getattr(serveruri, "Name", ServerContext);



		if uprc &amp;gt; 0 then do;
				call missing(type,id,Physischer_Pfad,Datenkbankschema_Label,Datenkbankschema_Name);
				rc=metadata_resolve(upasnuri,type,id);
					if type='Directory' then do;
							rc=metadata_getattr(upasnuri,'DirectoryName',Physischer_Pfad);
							output;
					end;
					else if type='DatabaseSchema' then do;
							rc=metadata_getattr(upasnuri,'Name',Datenkbankschema_Label);
							rc=metadata_getattr(upasnuri,'SchemaName',Datenkbankschema_Name);
							output;
					end;
				n+1;
				uprc=metadata_getnasn(liburi,'UsingPackages',n,upasnuri);
		end;

		nlibobj+1;

		put nlibobj=;

		librc=metadata_getnobj("omsobj:SASLibrary?@Id contains '.'",nlibobj,liburi);

	end;



run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;When comparing the two created datasets "&lt;CODE class=" language-sas"&gt;work.list_with_116&lt;/CODE&gt;" (this dataset has 116 observations") and "&lt;CODE class=" language-sas"&gt;work.list_with_114"&lt;/CODE&gt; (this dataset has 114 observations") , I can see, that in "work.list_with_114" two rows, i.e. two libraries, are missing, namely:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="two_libs.PNG" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/53799i4EC2598C19969717/image-size/medium?v=v2&amp;amp;px=400" role="button" title="two_libs.PNG" alt="two_libs.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What kind of engine is "list" ?&lt;/P&gt;&lt;P&gt;Why are they not in "work.list_with_114" compared to "work.list_with_116"?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be highly appreciated.&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;FK1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jan 2021 12:02:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Getting-all-libraries-from-meta-data/m-p/713329#M21560</guid>
      <dc:creator>FK1</dc:creator>
      <dc:date>2021-01-22T12:02:43Z</dc:date>
    </item>
    <item>
      <title>Re: Getting all libraries from meta data</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Getting-all-libraries-from-meta-data/m-p/716260#M21561</link>
      <description>&lt;P&gt;Did you ask tech support? Did you get the the bottom of this?&lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2021 23:16:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Getting-all-libraries-from-meta-data/m-p/716260#M21561</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-02-02T23:16:27Z</dc:date>
    </item>
    <item>
      <title>Re: Getting all libraries from meta data</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Getting-all-libraries-from-meta-data/m-p/717800#M21562</link>
      <description>&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;no, so far I did not get to the bottom of this. But I contacted Tech Support to see, whether they can answer my question.&lt;/P&gt;&lt;P&gt;I'll keep you posted, as soon as I will have gotten an answer...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2021 08:32:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Getting-all-libraries-from-meta-data/m-p/717800#M21562</guid>
      <dc:creator>FK1</dc:creator>
      <dc:date>2021-02-09T08:32:23Z</dc:date>
    </item>
    <item>
      <title>Re: Getting all libraries from meta data</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Getting-all-libraries-from-meta-data/m-p/719851#M21563</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;the problem seems to be, that the condition&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if uprc &amp;gt; 0 then do;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;is not greater than zero for some libraries!&lt;/P&gt;&lt;P&gt;When I put the values to the log, I can see that for two libraries (i.e. for iteration #73 and #74) uprc = -4&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ANFANG DO WHILE: nlibobj=73
rc=0
rc=0
rc=0
NOTE: UPRC: uprc=-4
NOTE: LIBURI: liburi=OMSOBJ:SASLibrary\A50H6R4H.B500001B
NOTE: N: n=1
NOTE: upasnuri: upasnuri=OMSOBJ:DatabaseSchema\A50H6R4H.BQ000012
ENDE DO WHILE: nlibobj=74
NOTE: im DO WHILE librc=116 (number of libraries)
ANFANG DO WHILE: nlibobj=74
rc=0
rc=0
rc=0
NOTE: UPRC: uprc=-4
NOTE: LIBURI: liburi=OMSOBJ:SASLibrary\A50H6R4H.B500001A
NOTE: N: n=1
NOTE: upasnuri: upasnuri=OMSOBJ:DatabaseSchema\A50H6R4H.BQ000012&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;So, the real qustion is, why does the "metadata_getasn"-function throw a "-4" with the given parameters?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;uprc=metadata_getnasn(liburi,'UsingPackages',n,upasnuri);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;When resolving the parameters for iteration #73,74 the code looks like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;metadata_getnasn("OMSOBJ:SASLibrary\A50H6R4H.B500001B",'UsingPackages',1,"OMSOBJ:DatabaseSchema\A50H6R4H.BQ000012");
metadata_getnasn("OMSOBJ:SASLibrary\A50H6R4H.B500001A",'UsingPackages',1,"OMSOBJ:DatabaseSchema\A50H6R4H.BQ000012");&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Refering to the&amp;nbsp;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=lrmeta&amp;amp;docsetTarget=p14bzkw6nfm2czn1gbb7hkvo2mvk.htm&amp;amp;locale=en#p0dkq744vkex6mn1edbmpstsvjhm" target="_self"&gt;Documentation of the metadata_getasn function&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can read that return code = -4 means that "&lt;EM&gt;n&lt;/EM&gt;&amp;nbsp;is out of range"...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you know, why this return code is being sent back for the two libraries, whereas for all other 114 libraries it works well?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Feb 2021 10:46:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Getting-all-libraries-from-meta-data/m-p/719851#M21563</guid>
      <dc:creator>FK1</dc:creator>
      <dc:date>2021-02-17T10:46:35Z</dc:date>
    </item>
    <item>
      <title>Re: Getting all libraries from meta data</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Getting-all-libraries-from-meta-data/m-p/720033#M21564</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/114220"&gt;@FK1&lt;/a&gt;&amp;nbsp; It's so nice to read well-presented well-articulated posts!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I do not know why -4 is returned for these two entries, but what it means is that there is no associated object number 1 for this association. In other words the association seems to be empty.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does this help? If not, again Tech Support might know more.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Moving the discussion to the &lt;STRONG&gt;admin&lt;/STRONG&gt; community where it might be seen by more knowledgeable people.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Feb 2021 20:41:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Getting-all-libraries-from-meta-data/m-p/720033#M21564</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-02-17T20:41:54Z</dc:date>
    </item>
    <item>
      <title>Re: Getting all libraries from meta data</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Getting-all-libraries-from-meta-data/m-p/720187#M21566</link>
      <description>&lt;P&gt;It looks like your second code only outputs if uprc &amp;gt; 0, so if a SASLibrary object does not have a "UsingPackages" association it would not be listed.&lt;BR /&gt;If you ran the libname statement:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname &amp;lt;libref&amp;gt; list;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It would return information on that library or that the library is not assigned.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could modify your query to this to exclude those libraries:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;omsobj:SASLibrary?SASLibrary[@Id contains '.'][UsingPackages/*]&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 18 Feb 2021 14:45:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Getting-all-libraries-from-meta-data/m-p/720187#M21566</guid>
      <dc:creator>gwootton</dc:creator>
      <dc:date>2021-02-18T14:45:55Z</dc:date>
    </item>
    <item>
      <title>Re: Getting all libraries from meta data</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Getting-all-libraries-from-meta-data/m-p/720444#M21576</link>
      <description>&lt;P&gt;Thank you,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;&amp;nbsp; for the compliment &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/78975"&gt;@gwootton&lt;/a&gt;&amp;nbsp;, thank you for your suggestion.&lt;/P&gt;&lt;P&gt;The nucleus of the problem can be circumvented by using your suggested code snippet.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In general, I must admit, that I do not have the deep dive insights, yet, of the SAS Open Metadata Architecture.&lt;/P&gt;&lt;P&gt;For example, it would be very helpful to me, to know in general, which oms objects elements are available, like e.g.&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;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="sas"&gt;omsobj:SASLibrary&lt;/LI-CODE&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;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I guess, I have to study the&amp;nbsp;&lt;A title="SAS® 9.4 Metadata Model: Reference" href="https://support.sas.com/documentation/cdl/en/omamodref/67417/HTML/default/viewer.htm#titlepage.htm" target="_self"&gt;SAS® 9.4 Metadata Model: Reference&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;There, I can find the complete list of Meta Data Types, that can be queried:&lt;BR /&gt;&lt;A href="https://support.sas.com/documentation/cdl/en/omamodref/67417/HTML/default/viewer.htm#alphalist.htm" target="_self"&gt;https://support.sas.com/documentation/cdl/en/omamodref/67417/HTML/default/viewer.htm#alphalist.htm&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2021 13:12:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Getting-all-libraries-from-meta-data/m-p/720444#M21576</guid>
      <dc:creator>FK1</dc:creator>
      <dc:date>2021-02-19T13:12:07Z</dc:date>
    </item>
    <item>
      <title>Re: Getting all libraries from meta data</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Getting-all-libraries-from-meta-data/m-p/720453#M21578</link>
      <description>Correct, the Metadata Model reference is where you would see all the objects. You may also be interested in using the metabrowse function in base SAS to explore the repository and its objects/associations.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/sastraining/2012/06/12/using-metabrowse-to-find-metadata/" target="_blank"&gt;https://blogs.sas.com/content/sastraining/2012/06/12/using-metabrowse-to-find-metadata/&lt;/A&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Feb 2021 13:41:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Getting-all-libraries-from-meta-data/m-p/720453#M21578</guid>
      <dc:creator>gwootton</dc:creator>
      <dc:date>2021-02-19T13:41:45Z</dc:date>
    </item>
  </channel>
</rss>

