<?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: missing values in a library in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/missing-values-in-a-library/m-p/811607#M320141</link>
    <description>&lt;P&gt;You will have to process each dataset using the cmiss (no need for nmiss, cmiss works with both types).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options dlcreatedir;

/* create some test data */
libname test "INSERT_A_DIR_NAME_HERE\test"; 

data test.class test.beta;
   set sashelp.class;

   if mod(_n_, 3) = 0 then Age = .;
   if mod(_n_, 7) = 0 then Weight = .;

   output test.class;

   if mod(_n_, 5) = 0 then Height = .;
   output test.beta;
run;


/* define the datasets holding the results */
data work.CountMiss;
   length Dataset $ 42 NumMissing 8;
   call missing(of _all_);
   stop;
run;

/* the macro will be called by the next data step */
%macro CountMissings(Dataset=);
   data _null_;
      set &amp;amp;Dataset. end=jobDone;

      NumMissing + cmiss(of _all_);

      if jobDone then do;
         call execute(catx(' ', 'proc sql noprint; insert into work.CountMiss'
            , 'set Dataset = "&amp;amp;Dataset.", NumMissing =', NumMissing, ';quit;'));
      end;
   run;
%mend;


/* call the macro for each dataset in the library test */
data _null_;
   set sashelp.vtable(keep= LibName MemName);
   where LibName = 'TEST';

   length Dataset $ 42;

   Dataset = cats(Libname, '.', MemName);

   call execute('%nrstr(%CountMissings(Dataset=' !! Dataset !! '))');
run;


/* print the results */
proc print data=work.CountMiss;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 05 May 2022 06:40:21 GMT</pubDate>
    <dc:creator>andreas_lds</dc:creator>
    <dc:date>2022-05-05T06:40:21Z</dc:date>
    <item>
      <title>missing values in a library</title>
      <link>https://communities.sas.com/t5/SAS-Programming/missing-values-in-a-library/m-p/811605#M320139</link>
      <description>&lt;P&gt;Hi guys&lt;/P&gt;
&lt;P&gt;we can find missing values by using nmiss and cmiss functions in a dataset so how to find&amp;nbsp;&lt;/P&gt;
&lt;P&gt;missing values in all datasets&amp;nbsp; and count in a library&amp;nbsp; i think dictionary.tables can does&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2022 05:43:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/missing-values-in-a-library/m-p/811605#M320139</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2022-05-05T05:43:14Z</dc:date>
    </item>
    <item>
      <title>Re: missing values in a library</title>
      <link>https://communities.sas.com/t5/SAS-Programming/missing-values-in-a-library/m-p/811607#M320141</link>
      <description>&lt;P&gt;You will have to process each dataset using the cmiss (no need for nmiss, cmiss works with both types).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options dlcreatedir;

/* create some test data */
libname test "INSERT_A_DIR_NAME_HERE\test"; 

data test.class test.beta;
   set sashelp.class;

   if mod(_n_, 3) = 0 then Age = .;
   if mod(_n_, 7) = 0 then Weight = .;

   output test.class;

   if mod(_n_, 5) = 0 then Height = .;
   output test.beta;
run;


/* define the datasets holding the results */
data work.CountMiss;
   length Dataset $ 42 NumMissing 8;
   call missing(of _all_);
   stop;
run;

/* the macro will be called by the next data step */
%macro CountMissings(Dataset=);
   data _null_;
      set &amp;amp;Dataset. end=jobDone;

      NumMissing + cmiss(of _all_);

      if jobDone then do;
         call execute(catx(' ', 'proc sql noprint; insert into work.CountMiss'
            , 'set Dataset = "&amp;amp;Dataset.", NumMissing =', NumMissing, ';quit;'));
      end;
   run;
%mend;


/* call the macro for each dataset in the library test */
data _null_;
   set sashelp.vtable(keep= LibName MemName);
   where LibName = 'TEST';

   length Dataset $ 42;

   Dataset = cats(Libname, '.', MemName);

   call execute('%nrstr(%CountMissings(Dataset=' !! Dataset !! '))');
run;


/* print the results */
proc print data=work.CountMiss;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 May 2022 06:40:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/missing-values-in-a-library/m-p/811607#M320141</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-05-05T06:40:21Z</dc:date>
    </item>
  </channel>
</rss>

