<?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: Number of observations for each view in a View Library in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Number-of-observations-for-each-view-in-a-View-Library/m-p/534677#M146751</link>
    <description>&lt;P&gt;Thank you for this and the ultra quick reply. I'll give this a try.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 12 Feb 2019 01:39:57 GMT</pubDate>
    <dc:creator>procsql</dc:creator>
    <dc:date>2019-02-12T01:39:57Z</dc:date>
    <item>
      <title>Number of observations for each view in a View Library</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Number-of-observations-for-each-view-in-a-View-Library/m-p/534671#M146746</link>
      <description>&lt;P&gt;Hello wonderful SAS community!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a SAS View library with about 500 views. I need a way to produce a dataset with all of the view names along with its respective number of observations for each view. I tried various datasets/views in the SASHELP library; however, none provided the number of observations for the data step views. Any guidance from the community would be much appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For context, I am using SAS EG 7.1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Feb 2019 01:02:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Number-of-observations-for-each-view-in-a-View-Library/m-p/534671#M146746</guid>
      <dc:creator>procsql</dc:creator>
      <dc:date>2019-02-12T01:02:53Z</dc:date>
    </item>
    <item>
      <title>Re: Number of observations for each view in a View Library</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Number-of-observations-for-each-view-in-a-View-Library/m-p/534673#M146748</link>
      <description>&lt;P&gt;Views are dynamic and only created when called. Depending exactly how the query is built, it’s possible to change on different runs, for example if you have a date time filter to pull everything as of end of day yesterday. That would change if you ran it tomorrow.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Otherwise, you can use the solution outlined here a few hours ago.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/New-SAS-User/Row-by-Row-operation-in-a-dataset/m-p/534645" target="_blank"&gt;https://communities.sas.com/t5/New-SAS-User/Row-by-Row-operation-in-a-dataset/m-p/534645&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/261356"&gt;@procsql&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello wonderful SAS community!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a SAS View library with about 500 views. I need a way to produce a dataset with all of the view names along with its respective number of observations for each view. I tried various datasets/views in the SASHELP library; however, none provided the number of observations for the data step views. Any guidance from the community would be much appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For context, I am using SAS EG 7.1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Feb 2019 01:13:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Number-of-observations-for-each-view-in-a-View-Library/m-p/534673#M146748</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-02-12T01:13:33Z</dc:date>
    </item>
    <item>
      <title>Re: Number of observations for each view in a View Library</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Number-of-observations-for-each-view-in-a-View-Library/m-p/534674#M146749</link>
      <description>&lt;P&gt;By definition if you want to know how many observations a VIEW will return if someone actually queried it you need to query the view.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an example for how to generate the queries to get the counts from the list of views.&lt;/P&gt;
&lt;P&gt;If you have more than a hand full of views then you will need to modify the method to not use a macro variable to store the code.&amp;nbsp; You could use a macro or a data step to generate the queries instead.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ds1;
 set sashelp.class;
run;
data view1/view=view1;
 set ds1;
run;

proc sql noprint ;
create table sizes as
select 
  a.libname
 ,a.memname
 ,a.memtype
 ,b.nobs
from dictionary.members a
inner join dictionary.tables b
on a.libname=b.libname and a.memname=b.memname
where a.libname='WORK'
  and a.memname in ('DS1','VIEW1') 
;
select catx(' ','update sizes set nobs = (select count(1) from',catx('.',libname,memname),')')
  into :code separated by ';'
  from sizes
  where memtype='VIEW'
;
%put %superq(code);
&amp;amp;code ;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;Obs    libname    memname    memtype    nobs

 1      WORK       DS1        DATA       19
 2      WORK       VIEW1      VIEW       19

&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Feb 2019 01:22:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Number-of-observations-for-each-view-in-a-View-Library/m-p/534674#M146749</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-02-12T01:22:51Z</dc:date>
    </item>
    <item>
      <title>Re: Number of observations for each view in a View Library</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Number-of-observations-for-each-view-in-a-View-Library/m-p/534677#M146751</link>
      <description>&lt;P&gt;Thank you for this and the ultra quick reply. I'll give this a try.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Feb 2019 01:39:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Number-of-observations-for-each-view-in-a-View-Library/m-p/534677#M146751</guid>
      <dc:creator>procsql</dc:creator>
      <dc:date>2019-02-12T01:39:57Z</dc:date>
    </item>
    <item>
      <title>Re: Number of observations for each view in a View Library</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Number-of-observations-for-each-view-in-a-View-Library/m-p/534678#M146752</link>
      <description>&lt;P&gt;Thank you for this and the ultra quick reply! I will definitely give this a try.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Feb 2019 01:40:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Number-of-observations-for-each-view-in-a-View-Library/m-p/534678#M146752</guid>
      <dc:creator>procsql</dc:creator>
      <dc:date>2019-02-12T01:40:43Z</dc:date>
    </item>
  </channel>
</rss>

