<?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 wird behavior when using exists with libname assigned viea metadata in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/wird-behavior-when-using-exists-with-libname-assigned-viea/m-p/896869#M354396</link>
    <description>&lt;P&gt;When using the "metaout" option in SAS on a SQL database views, behavior varies based on the option:&lt;/P&gt;&lt;P&gt;With "metaout=ALL," use "exist(view)" to get true. Example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data _null_;
rc = libname("jb_dw", "", "META", "liburi=""SASLibrary?@libref='jb_dw'"" metaout=ALL");
if rc ne 0 then do;
   put rc=;
   put ms=;
end;
run;

%put exist=%sysfunc(exist(jb_dw.BANKDAGE_STAMOPL)); *false;
%put exist_view=%sysfunc(exist(jb_dw.BANKDAGE_STAMOPL,view)); *true;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;With "metaout=data," use "exist" (without "view") to get true. Example:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data _null_;
rc = libname("jb_dw", "", "META", "liburi=""SASLibrary?@libref='jb_dw'"" metaout=data");
if rc ne 0 then do;
   put rc=;
   put ms=;
end;
run;
%put exist=%sysfunc(exist(jb_dw.BANKDAGE_STAMOPL)); *true;
%put exist_view=%sysfunc(exist(jb_dw.BANKDAGE_STAMOPL,view)); *false;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Can anybody explain this behavior?&lt;/P&gt;</description>
    <pubDate>Tue, 03 Oct 2023 08:37:45 GMT</pubDate>
    <dc:creator>rudfaden</dc:creator>
    <dc:date>2023-10-03T08:37:45Z</dc:date>
    <item>
      <title>wird behavior when using exists with libname assigned viea metadata</title>
      <link>https://communities.sas.com/t5/SAS-Programming/wird-behavior-when-using-exists-with-libname-assigned-viea/m-p/896869#M354396</link>
      <description>&lt;P&gt;When using the "metaout" option in SAS on a SQL database views, behavior varies based on the option:&lt;/P&gt;&lt;P&gt;With "metaout=ALL," use "exist(view)" to get true. Example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data _null_;
rc = libname("jb_dw", "", "META", "liburi=""SASLibrary?@libref='jb_dw'"" metaout=ALL");
if rc ne 0 then do;
   put rc=;
   put ms=;
end;
run;

%put exist=%sysfunc(exist(jb_dw.BANKDAGE_STAMOPL)); *false;
%put exist_view=%sysfunc(exist(jb_dw.BANKDAGE_STAMOPL,view)); *true;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;With "metaout=data," use "exist" (without "view") to get true. Example:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data _null_;
rc = libname("jb_dw", "", "META", "liburi=""SASLibrary?@libref='jb_dw'"" metaout=data");
if rc ne 0 then do;
   put rc=;
   put ms=;
end;
run;
%put exist=%sysfunc(exist(jb_dw.BANKDAGE_STAMOPL)); *true;
%put exist_view=%sysfunc(exist(jb_dw.BANKDAGE_STAMOPL,view)); *false;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Can anybody explain this behavior?&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 08:37:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/wird-behavior-when-using-exists-with-libname-assigned-viea/m-p/896869#M354396</guid>
      <dc:creator>rudfaden</dc:creator>
      <dc:date>2023-10-03T08:37:45Z</dc:date>
    </item>
    <item>
      <title>Re: wird behavior when using exists with libname assigned viea metadata</title>
      <link>https://communities.sas.com/t5/SAS-Programming/wird-behavior-when-using-exists-with-libname-assigned-viea/m-p/896951#M354448</link>
      <description>&lt;P&gt;I think the point is that when you use the METAOUT=DATA, the libname refers to the physical library. The &lt;A href="https://support.sas.com/documentation/cdl/en/lrmeta/60739/HTML/default/viewer.htm#a003091824.htm" target="_self"&gt;documentation&lt;/A&gt;&amp;nbsp;says&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;specifies that you can read, create, update, and delete physical tables.&lt;/P&gt;
&lt;TABLE cellspacing="2" cellpadding="4"&gt;
&lt;TBODY&gt;
&lt;TR valign="top"&gt;
&lt;TD width="95" align="left" class="label"&gt;Interaction:&lt;/TD&gt;
&lt;TD align="left" class="bgBlockLight"&gt;The user can access any table, regardless of whether it has been defined in the repository.&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;As the library is on SQL server, and SAS allows access to all tables or views, regardless of whether they have been defined in metadata&amp;nbsp; or not, SAS does not know if it is a table or a view, because it reads the SQL server directory, not the metadata.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you use METAOUT=ALL, the documentation specifies that you can only access tables or views that are registered in metadata. Which means that SAS uses the metadata repository to find the tables or views, and if your view is correctly registered there, it will show as a view.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 14:51:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/wird-behavior-when-using-exists-with-libname-assigned-viea/m-p/896951#M354448</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2023-10-03T14:51:52Z</dc:date>
    </item>
    <item>
      <title>Re: wird behavior when using exists with libname assigned viea metadata</title>
      <link>https://communities.sas.com/t5/SAS-Programming/wird-behavior-when-using-exists-with-libname-assigned-viea/m-p/897117#M354511</link>
      <description>&lt;P&gt;Don't see how this explains the behavior. Why would this lead to a difference en how exists work?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FIY, the table is registred in metadata.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2023 10:12:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/wird-behavior-when-using-exists-with-libname-assigned-viea/m-p/897117#M354511</guid>
      <dc:creator>rudfaden</dc:creator>
      <dc:date>2023-10-04T10:12:53Z</dc:date>
    </item>
    <item>
      <title>Re: wird behavior when using exists with libname assigned viea metadata</title>
      <link>https://communities.sas.com/t5/SAS-Programming/wird-behavior-when-using-exists-with-libname-assigned-viea/m-p/897241#M354540</link>
      <description>&lt;P&gt;Because one option (METAOUT=ALL) asks SAS to check the metadata repository for information about tables and views, while the other(METAOUT=DATA) lets SAS access the SQL Server directory directly. When you use the direct access, SAS does NOT read the metadata, but just reads the SQL server directory - this basic service will show you what is physically there, but will give you the same result as assigning the library with a basic SQL Server libname statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So one option gives you access to the metadata (but will not show you tables or views not registered in metadata), the other will show what's actually on the SQL server when you ask, but that option does not read the metadata to see if you are dealing with a table or a view. On the other hand, it will show you what's actually there (also tables or views that are not registered in metadata, but not tables or views that are registered in metadata, but which do not actually exist). The latter option does not read the metadata, and does not know if something is a table or a view.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2023 19:10:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/wird-behavior-when-using-exists-with-libname-assigned-viea/m-p/897241#M354540</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2023-10-04T19:10:42Z</dc:date>
    </item>
  </channel>
</rss>

