<?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: Dynamically Profile for Nulls in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Dynamically-Profile-for-Nulls/m-p/513875#M73174</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods select none;
ods output nlevels=want;
proc freq data=sashelp.heart nlevels;
table _all_;
run;
ods select all;
proc print data=want(where=(NMissLevels ne 0));run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 16 Nov 2018 13:58:07 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2018-11-16T13:58:07Z</dc:date>
    <item>
      <title>Dynamically Profile for Nulls</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Dynamically-Profile-for-Nulls/m-p/513530#M73145</link>
      <description>&lt;P&gt;Is there a simple way to create a list of variables that contain nulls?&amp;nbsp; I found a way to do it if I manually refer to the column by name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;E.g.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;select count(*)&lt;BR /&gt; from&amp;nbsp;my table&lt;BR /&gt; where employee_category is null&lt;BR /&gt; group by employee_category&lt;BR /&gt; having count(*) &amp;gt; 0) as employee_category_nulls&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Returns number of nulls in column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Even better is to only return a list of columns that contains nulls and the number of nulls.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2018 19:53:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Dynamically-Profile-for-Nulls/m-p/513530#M73145</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2018-11-15T19:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically Profile for Nulls</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Dynamically-Profile-for-Nulls/m-p/513576#M73151</link>
      <description>&lt;P&gt;I believe you have to check each variable on all observations.&lt;/P&gt;
&lt;P&gt;That can be done in one step using two arrays, as in next code (not tested):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _NULL_;
  set have end=eof;
   array vx {*} _numeric_;    /* if need create separate array for _charcter_ */
   array nx  $  n1-n100;      /* up to 100 variables. adapt to need */ 
   length list  $1000;        /* adapt length to contain full list of var names */     

   /* fulfill variable names */
   do i=1 to dim(vx);
        nx(i) = vname(vx(i));
   end;

   /* check each numeric var in an observation */
   do i=1 to dim(vx);
        if vx(i) = .  and findw(list,nx(i)) = 0
        then catx(' ',trim(list), nx(i));
  end;
           
  if eof then put  list=;
run;
        &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Nov 2018 20:32:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Dynamically-Profile-for-Nulls/m-p/513576#M73151</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2018-11-15T20:32:36Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically Profile for Nulls</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Dynamically-Profile-for-Nulls/m-p/513582#M73152</link>
      <description>&lt;P&gt;Currently debugging this to see if it works.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2018 20:35:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Dynamically-Profile-for-Nulls/m-p/513582#M73152</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2018-11-15T20:35:36Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically Profile for Nulls</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Dynamically-Profile-for-Nulls/m-p/513595#M73153</link>
      <description>&lt;P&gt;If there was a way to do the below and only include instances where the column is character and has missing:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;PROC&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;FORMAT&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
	&lt;SPAN class="token keyword"&gt;value&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;$&lt;/SPAN&gt;missfmt &lt;SPAN class="token string"&gt;' '&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'Missing'&lt;/SPAN&gt; other&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'Not Missing'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
	&lt;SPAN class="token keyword"&gt;value&lt;/SPAN&gt;  missfmt  &lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'Missing'&lt;/SPAN&gt; other&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'Not Missing'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;RUN&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="token procnames"&gt;PROC&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;FREQ&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;DATA&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;CCW&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;INTGRD_INPA&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;FORMAT&lt;/SPAN&gt; _CHAR_ &lt;SPAN class="token punctuation"&gt;$&lt;/SPAN&gt;missfmt&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;TABLES&lt;/SPAN&gt; _CHAR_ &lt;SPAN class="token operator"&gt;/&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;missing&lt;/SPAN&gt; missprint nocum nopercent&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;FORMAT&lt;/SPAN&gt; _NUMERIC_ missfmt&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;TABLES&lt;/SPAN&gt; _NUMERIC_ &lt;SPAN class="token operator"&gt;/&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;missing&lt;/SPAN&gt; missprint nocum nopercent&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;	
&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;RUN&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Nov 2018 20:52:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Dynamically-Profile-for-Nulls/m-p/513595#M73153</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2018-11-15T20:52:07Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically Profile for Nulls</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Dynamically-Profile-for-Nulls/m-p/513604#M73154</link>
      <description>&lt;P&gt;Here is the code adapted to check CHAR variables: (the formats not needed)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _NULL_;
  set have end=eof;
   array vx $ _charcter_;
   array nx $  n1-n100;      /* up to 100 variables. adapt to need */ 
   length list  $1000;        /* adapt length to contain full list of var names */     

   /* fulfill variable names */
   do i=1 to dim(vx);
        nx(i) = vname(vx(i));
   end;

   /* check each numeric var in an observation */
   do i=1 to dim(vx);
        if missing(vx(i))  and findw(list,nx(i)) = 0
        then catx(' ',trim(list), nx(i));
  end;
           
  if eof then put  list=;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2018 21:01:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Dynamically-Profile-for-Nulls/m-p/513604#M73154</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2018-11-15T21:01:09Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically Profile for Nulls</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Dynamically-Profile-for-Nulls/m-p/513613#M73155</link>
      <description>&lt;P&gt;When I run this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;then catx(' ',trim(list), nx(i));&lt;BR /&gt; _&lt;BR /&gt; 22&lt;BR /&gt; 76&lt;BR /&gt;ERROR: Undeclared array referenced: catx.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2018 21:05:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Dynamically-Profile-for-Nulls/m-p/513613#M73155</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2018-11-15T21:05:19Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically Profile for Nulls</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Dynamically-Profile-for-Nulls/m-p/513663#M73159</link>
      <description>&lt;P&gt;Sorry, line should be:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; list =&amp;nbsp;catx(' ',trim(list), nx(i));&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2018 21:43:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Dynamically-Profile-for-Nulls/m-p/513663#M73159</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2018-11-15T21:43:42Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically Profile for Nulls</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Dynamically-Profile-for-Nulls/m-p/513668#M73161</link>
      <description>&lt;P&gt;The output is&amp;nbsp;list=_charcte&lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2018 21:47:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Dynamically-Profile-for-Nulls/m-p/513668#M73161</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2018-11-15T21:47:40Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically Profile for Nulls</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Dynamically-Profile-for-Nulls/m-p/513683#M73164</link>
      <description>&lt;P&gt;Change array definitions (tested):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token statement"&gt;array&lt;/SPAN&gt; vx {*} &lt;SPAN class="token punctuation"&gt;$&lt;/SPAN&gt; _character_&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token statement"&gt;array&lt;/SPAN&gt; nx {*} &lt;SPAN class="token punctuation"&gt;$&lt;/SPAN&gt;  n1&lt;SPAN class="token operator"&gt;-&lt;/SPAN&gt;n100&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;  &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Nov 2018 22:09:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Dynamically-Profile-for-Nulls/m-p/513683#M73164</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2018-11-15T22:09:06Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically Profile for Nulls</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Dynamically-Profile-for-Nulls/m-p/513687#M73165</link>
      <description>add also:&lt;BR /&gt;  length n1-n100 $10; /* adapt to max var name length */</description>
      <pubDate>Thu, 15 Nov 2018 22:10:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Dynamically-Profile-for-Nulls/m-p/513687#M73165</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2018-11-15T22:10:44Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically Profile for Nulls</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Dynamically-Profile-for-Nulls/m-p/513875#M73174</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods select none;
ods output nlevels=want;
proc freq data=sashelp.heart nlevels;
table _all_;
run;
ods select all;
proc print data=want(where=(NMissLevels ne 0));run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Nov 2018 13:58:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Dynamically-Profile-for-Nulls/m-p/513875#M73174</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-11-16T13:58:07Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically Profile for Nulls</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Dynamically-Profile-for-Nulls/m-p/514876#M73217</link>
      <description>&lt;P&gt;Ksharp, thank you, your code is extremely helpful for profiling.&amp;nbsp; I found that adding&amp;nbsp;table _CHARACTER_ is useful as there is not as much purpose to mass checking for null numbers.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Nov 2018 18:09:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Dynamically-Profile-for-Nulls/m-p/514876#M73217</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2018-11-20T18:09:00Z</dc:date>
    </item>
  </channel>
</rss>

