<?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 Bulk Query View Definitions. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Bulk-Query-View-Definitions/m-p/267856#M52966</link>
    <description>&lt;P&gt;Hi There,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've been racking my brains all morning trying to figure this one out.&lt;/P&gt;
&lt;P&gt;Is there a way to query the definition of a view, for example I want to know how many views in my library use a particular table/dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc Sql;&lt;/P&gt;
&lt;P&gt;Create Table Views as&lt;/P&gt;
&lt;P&gt;Select *&lt;/P&gt;
&lt;P&gt;From &amp;lt;ViewDefs&amp;gt;&lt;/P&gt;
&lt;P&gt;Where ViewName = 'MyView'&lt;/P&gt;
&lt;P&gt;and DefCol like '%datasetname%'&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;Quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 03 May 2016 09:49:31 GMT</pubDate>
    <dc:creator>JoeMadden</dc:creator>
    <dc:date>2016-05-03T09:49:31Z</dc:date>
    <item>
      <title>Bulk Query View Definitions.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Bulk-Query-View-Definitions/m-p/267856#M52966</link>
      <description>&lt;P&gt;Hi There,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've been racking my brains all morning trying to figure this one out.&lt;/P&gt;
&lt;P&gt;Is there a way to query the definition of a view, for example I want to know how many views in my library use a particular table/dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc Sql;&lt;/P&gt;
&lt;P&gt;Create Table Views as&lt;/P&gt;
&lt;P&gt;Select *&lt;/P&gt;
&lt;P&gt;From &amp;lt;ViewDefs&amp;gt;&lt;/P&gt;
&lt;P&gt;Where ViewName = 'MyView'&lt;/P&gt;
&lt;P&gt;and DefCol like '%datasetname%'&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;Quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 May 2016 09:49:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Bulk-Query-View-Definitions/m-p/267856#M52966</guid>
      <dc:creator>JoeMadden</dc:creator>
      <dc:date>2016-05-03T09:49:31Z</dc:date>
    </item>
    <item>
      <title>Re: Bulk Query View Definitions.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Bulk-Query-View-Definitions/m-p/267867#M52969</link>
      <description>&lt;P&gt;Tha's a great question!&lt;/P&gt;
&lt;P&gt;Unfortunately, I'm not aware of any out-of-box functionality for this.&lt;/P&gt;
&lt;P&gt;But it would good thought, like in SQL Server where you can see dependencies of a view directly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, perhaps you need to parse all view definitions (looking&amp;nbsp;for keywords like from, join etc).&lt;/P&gt;
&lt;P&gt;But then you might have data step views...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When dealing with larger implementations, I usually have access to metadata tool, in SAS that would be DI Studio. Then you create the metadata first, then create any view/table with code derived directly&amp;nbsp;from metadata.&lt;/P&gt;</description>
      <pubDate>Tue, 03 May 2016 10:13:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Bulk-Query-View-Definitions/m-p/267867#M52969</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-05-03T10:13:16Z</dc:date>
    </item>
    <item>
      <title>Re: Bulk Query View Definitions.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Bulk-Query-View-Definitions/m-p/267892#M52974</link>
      <description>&lt;P&gt;Hi To query which views are available you can use DICTIONARY.VIEWS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13674"&gt;@LinusH﻿&lt;/a&gt; pointed out, to actually figure out what tables and columns are coming from which tables/views you need to parse the output of the DESCRIBE statement from Proc SQL or the DATA Step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below are some code examples:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.ds_view / view=work.ds_view;
  set sashelp.cars;
run;

proc sql;
  create table myviews as
  select
    *
  from
    dictionary.views
  ;
quit;

proc sql;
  describe view SASHELP.VTABLE;
quit;

data view=work.ds_view;
  describe;
run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Bruno&lt;/P&gt;</description>
      <pubDate>Tue, 03 May 2016 12:04:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Bulk-Query-View-Definitions/m-p/267892#M52974</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2016-05-03T12:04:12Z</dc:date>
    </item>
  </channel>
</rss>

