<?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: How to find is specific dataset available  ( with observations) in the active libraries. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-is-specific-dataset-available-with-observations-in/m-p/828897#M327457</link>
    <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;. My libraries are not month names I just created for Example purpose. Your solution satisfies my requirement except, In my 'March' Library the 'expense' dataset don't have any observations&amp;nbsp; and April have one Observation. But my 'Want' dataset shows there is ' one' observation in&amp;nbsp; March. Expense dataset. What I am doing wrong here?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
proc sql;
create table want as
select libname, memname, nobs from sashelp.vtable
where upcase(libname) in ('APRIL' 'MARCH' 'FEB')
and upcase(memname) in ('EXPENSE', 'DEBT');
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SASuserlot_0-1660669455183.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/74469i54A00B2E0AA28BD5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SASuserlot_0-1660669455183.png" alt="SASuserlot_0-1660669455183.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 16 Aug 2022 17:05:08 GMT</pubDate>
    <dc:creator>SASuserlot</dc:creator>
    <dc:date>2022-08-16T17:05:08Z</dc:date>
    <item>
      <title>How to find is specific dataset available  ( with observations) in the active libraries.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-is-specific-dataset-available-with-observations-in/m-p/828874#M327451</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I&amp;nbsp; have some requirement, where I need to check is specific dataset exist in the active libraries with observations or not! and finally create the dataset that&amp;nbsp; gives overview of the libraries. Is it possible? I will try to give the example below.&lt;/P&gt;
&lt;P&gt;Example. I have a default macro that creates the active libraries like Feb, March, April which contains Expense, and or debt datasets in the respective libraries (&amp;nbsp; since I cannot give the macro, I wrote individual libnames in the code). And finally create dataset&amp;nbsp; given in the image. I do have the idea about %sysfunc (exist (xx)) but not sure How to use to achieve this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; libname feb 'c\desktop\New folder3';

 data feb.debt;
 month= feb ;
 debt=500;
 run;

 libname march 'c\desktop\New folder2';

 data March.expense;
 run;

 libname april 'c\desktop\New folder1';

 data april.expense;
 month=april;
 expense=200;
 run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My requirement is&lt;/P&gt;
&lt;P&gt;1. Check&amp;nbsp; each library for 'expense' dataset available or not?&lt;/P&gt;
&lt;P&gt;2. if the 'Expense' dataset available then check for is there any observations available or not.(Note: March library have the dataset but no observations in it.)&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SASuserlot_0-1660663519045.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/74466i229F025D2FCAEFF8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SASuserlot_0-1660663519045.png" alt="SASuserlot_0-1660663519045.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Ps: We have the flexibility to modify the datasets creation (I given best of my abilities to simulate my requirement).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2022 15:32:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-is-specific-dataset-available-with-observations-in/m-p/828874#M327451</guid>
      <dc:creator>SASuserlot</dc:creator>
      <dc:date>2022-08-16T15:32:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to find is specific dataset available  ( with observations) in the active libraries.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-is-specific-dataset-available-with-observations-in/m-p/828883#M327454</link>
      <description>&lt;P&gt;The sashelp.vtable data set contains a list of all assigned libraries and their data sets and the number of observations.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can filter that data set for the libraries and data sets of interest.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are your library names actually month names? Would it check up to current month (August), previous month (July) or end of the year?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want as
select libname, memname, nobs, from sashelp.vtable
where libname in (list of libraries)
and memname in ('EXPENSE', 'DEBT');
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then wrangle it to your desired format.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2022 16:39:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-is-specific-dataset-available-with-observations-in/m-p/828883#M327454</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-08-16T16:39:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to find is specific dataset available  ( with observations) in the active libraries.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-is-specific-dataset-available-with-observations-in/m-p/828897#M327457</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;. My libraries are not month names I just created for Example purpose. Your solution satisfies my requirement except, In my 'March' Library the 'expense' dataset don't have any observations&amp;nbsp; and April have one Observation. But my 'Want' dataset shows there is ' one' observation in&amp;nbsp; March. Expense dataset. What I am doing wrong here?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
proc sql;
create table want as
select libname, memname, nobs from sashelp.vtable
where upcase(libname) in ('APRIL' 'MARCH' 'FEB')
and upcase(memname) in ('EXPENSE', 'DEBT');
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SASuserlot_0-1660669455183.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/74469i54A00B2E0AA28BD5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SASuserlot_0-1660669455183.png" alt="SASuserlot_0-1660669455183.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2022 17:05:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-is-specific-dataset-available-with-observations-in/m-p/828897#M327457</guid>
      <dc:creator>SASuserlot</dc:creator>
      <dc:date>2022-08-16T17:05:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to find is specific dataset available  ( with observations) in the active libraries.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-is-specific-dataset-available-with-observations-in/m-p/828902#M327458</link>
      <description>&lt;P&gt;Once a data set exists in SAS it has at least one row recorded. If you need to check if that row has actual information you'll need to scan the table. If you have control over this process it's better to fix this issue before this process, where if the table has no data it is not created at all....&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2022 17:32:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-is-specific-dataset-available-with-observations-in/m-p/828902#M327458</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-08-16T17:32:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to find is specific dataset available  ( with observations) in the active libraries.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-is-specific-dataset-available-with-observations-in/m-p/829019#M327507</link>
      <description>&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2022 13:34:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-is-specific-dataset-available-with-observations-in/m-p/829019#M327507</guid>
      <dc:creator>SASuserlot</dc:creator>
      <dc:date>2022-08-17T13:34:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to find is specific dataset available  ( with observations) in the active libraries.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-is-specific-dataset-available-with-observations-in/m-p/829022#M327509</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Once a data set exists in SAS it has at least one row recorded. If you need to check if that row has actual information you'll need to scan the table. If you have control over this process it's better to fix this issue before this process, where if the table has no data it is not created at all....&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It is definitely possible to create a dataset with zero observations, and DICTIONARY.TABLES will show that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an example;&lt;/P&gt;
&lt;PRE&gt;1    data empty;
2      stop;
3    run;

NOTE: The data set WORK.EMPTY has 0 observations and 0 variables.
NOTE: DATA statement used (Total process time):
      real time           0.03 seconds
      cpu time            0.03 seconds


4    proc print data=sashelp.vtable;
NOTE: Writing HTML Body file: sashtml.htm
5      where memname='EMPTY' and libname='WORK';
6      var libname memname nobs;
7    run;

NOTE: There were 1 observations read from the data set SASHELP.VTABLE.
      WHERE (memname='EMPTY') and (libname='WORK');
&lt;/PRE&gt;
&lt;P&gt;Result&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tom_0-1660743996150.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/74490i2694CBB2808D9856/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Tom_0-1660743996150.png" alt="Tom_0-1660743996150.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2022 13:46:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-is-specific-dataset-available-with-observations-in/m-p/829022#M327509</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-08-17T13:46:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to find is specific dataset available  ( with observations) in the active libraries.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-is-specific-dataset-available-with-observations-in/m-p/829026#M327511</link>
      <description>&lt;P&gt;It's possible but most code doesn't have a STOP so if it errors out that won't happen &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2022 13:58:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-is-specific-dataset-available-with-observations-in/m-p/829026#M327511</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-08-17T13:58:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to find is specific dataset available  ( with observations) in the active libraries.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-is-specific-dataset-available-with-observations-in/m-p/829030#M327515</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;It's possible but most code doesn't have a STOP so if it errors out that won't happen &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Huh?&lt;/P&gt;
&lt;PRE&gt;8    data empty;
9     set sashelp.class;
10    where age &amp;lt; 5 ;
11   run;

NOTE: There were 0 observations read from the data set SASHELP.CLASS.
      WHERE age&amp;lt;5;
NOTE: The data set WORK.EMPTY has 0 observations and 5 variables.
&lt;/PRE&gt;
&lt;P&gt;Steps that fail is a different question.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2022 14:00:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-is-specific-dataset-available-with-observations-in/m-p/829030#M327515</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-08-17T14:00:52Z</dc:date>
    </item>
  </channel>
</rss>

