<?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: Report on missing values of each coloumn in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Report-on-missing-values-of-each-coloumn/m-p/228969#M41387</link>
    <description>&lt;P&gt;For one dataset, you would use PROC MEANS with the NMISS option in the OUTPUT statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For multiple datasets, you could use a macro that loops through all of them, each using PROC MEANS.&lt;/P&gt;</description>
    <pubDate>Wed, 07 Oct 2015 19:13:03 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2015-10-07T19:13:03Z</dc:date>
    <item>
      <title>Report on missing values of each coloumn</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Report-on-missing-values-of-each-coloumn/m-p/228966#M41385</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;I have a data set more than 100 fields ,where I have to check the missing values of each field&amp;nbsp; an the percentage of missing .&lt;/P&gt;
&lt;P&gt;So i have to write a code where multiple data sets can be executed and should give&amp;nbsp; the reports of each field of all data set in one final output .&lt;/P&gt;
&lt;P&gt;your help is much appreciated&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 07 Oct 2015 18:54:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Report-on-missing-values-of-each-coloumn/m-p/228966#M41385</guid>
      <dc:creator>siddharthpeesary</dc:creator>
      <dc:date>2015-10-07T18:54:16Z</dc:date>
    </item>
    <item>
      <title>Re: Report on missing values of each coloumn</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Report-on-missing-values-of-each-coloumn/m-p/228969#M41387</link>
      <description>&lt;P&gt;For one dataset, you would use PROC MEANS with the NMISS option in the OUTPUT statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For multiple datasets, you could use a macro that loops through all of them, each using PROC MEANS.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Oct 2015 19:13:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Report-on-missing-values-of-each-coloumn/m-p/228969#M41387</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2015-10-07T19:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: Report on missing values of each coloumn</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Report-on-missing-values-of-each-coloumn/m-p/228978#M41388</link>
      <description>&lt;P&gt;Here's an approach:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc format;&lt;/P&gt;&lt;P&gt;value present low-high='Present' other='Missing';&lt;/P&gt;&lt;P&gt;value $present ' '='Missing' other='Present';&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc freq data=mydata;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; tables _character_ _numeric_ / missing;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; format _character_ $present.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; format _numeric_ present.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You will get an error message if you encounter a data set that contains all numeric variables (or all character variables).&amp;nbsp; A mix is required.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Oct 2015 19:28:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Report-on-missing-values-of-each-coloumn/m-p/228978#M41388</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-10-07T19:28:26Z</dc:date>
    </item>
    <item>
      <title>Re: Report on missing values of each coloumn</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Report-on-missing-values-of-each-coloumn/m-p/228979#M41389</link>
      <description>&lt;P&gt;Hi. &amp;nbsp;Take a look at (fixed the indenting in the data&amp;nbsp;so you can actually&amp;nbsp;see what's going on)&amp;nbsp;...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;An Easy Route to a Missing Data Report with ODS+PROC FREQ+A Data Step&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.lexjansen.com/nesug/nesug11/ds/ds12.pdf" target="_blank"&gt;http://www.lexjansen.com/nesug/nesug11/ds/ds12.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It explains why this SAS code works. &amp;nbsp;All you have to do for any data set is change the name of the data set used in PROC FREQ. &amp;nbsp;No other changes are required. &amp;nbsp;The code produced the attached report when I used the SASHELP.HEART. &amp;nbsp;All you have to do is cut/paste/change data set name/run.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;proc format;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;value nm . = '0' other = '1';&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;value $ch ' ' = '0' other = '1';&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;ods listing close;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;ods output onewayfreqs=tables;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;proc freq data=sashelp.heart;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; tables _all_ / missing;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp;format _numeric_ nm.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; _character_ $ch.;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;ods output close;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;ods listing;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;data report;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;length var $32; &lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;do until (last.table); &lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&amp;nbsp; set tables; &lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&amp;nbsp; by table notsorted;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&amp;nbsp; array names(*) f_: ;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&amp;nbsp; select (names(_n_)); &lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; when ('0') do; &lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; miss = frequency;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; p_miss = percent;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&amp;nbsp; end;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&amp;nbsp; when ('1') do; &lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ok = frequency;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; p_ok = percent;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&amp;nbsp; end;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&amp;nbsp; end;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;end;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;miss = coalesce(miss,0); &lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;ok = coalesce(ok,0);&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;p_miss = coalesce(p_miss,0);&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;p_ok = coalesce(p_ok,0);&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;var = scan(table,-1); &lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;keep var miss ok p_: ; &lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;format miss ok comma7. p_: 5.1;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;label&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;miss = 'N_MISSING'&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;ok = 'N_OK'&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;p_miss = '%_MISSING'&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;p_ok = '%_OK'&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;var = 'VARIABLE'&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/11998iA8FCDF359EB09776/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="report.png" title="report.png" /&gt;</description>
      <pubDate>Wed, 07 Oct 2015 23:58:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Report-on-missing-values-of-each-coloumn/m-p/228979#M41389</guid>
      <dc:creator>MikeZdeb</dc:creator>
      <dc:date>2015-10-07T23:58:15Z</dc:date>
    </item>
    <item>
      <title>Re: Report on missing values of each coloumn</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Report-on-missing-values-of-each-coloumn/m-p/228982#M41390</link>
      <description>&lt;P&gt;Here is code to get you started. It will create a data set called missing_vars that has the percent and variable names of the data set test. You will need to macro-tize this so it will run through all the data sets you need to include in your report.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data test;&lt;BR /&gt;input x1 x2 x3 x4 y $;&lt;BR /&gt;cards;&lt;BR /&gt;1 . 1 1 a&lt;BR /&gt;13 2 . 5 b&lt;BR /&gt;11 . 1 . c&lt;BR /&gt;2 3 4 5 d&lt;BR /&gt;3 4 5 6 e&lt;BR /&gt;. 8 9 . f&lt;BR /&gt;5 6 7 8 g&lt;BR /&gt;8 9 8 9 h&lt;BR /&gt;3 5 8 . i&lt;BR /&gt;6 8 7 9 j&lt;BR /&gt;;&lt;BR /&gt;options mprint symbolgen mlogic;&lt;BR /&gt;data _null_;&lt;BR /&gt;if 0 then set test;&lt;BR /&gt;array num(*) _numeric_;&lt;BR /&gt;array chars(*) _character_;&lt;BR /&gt;call symput('nums',trim(left(put(dim(num),8.))));&lt;BR /&gt;call symput('chars',trim(left(put(dim(chars),8.))));&lt;BR /&gt;stop;&lt;BR /&gt;run; &lt;BR /&gt;data missing_vars;&lt;BR /&gt;set test end=end nobs=obsnum;&lt;BR /&gt;array num(*) _numeric_;&lt;BR /&gt;array chars(*) $ _character_;&lt;BR /&gt;array misscountn (&amp;amp;nums.) (&amp;amp;nums.*0);&lt;BR /&gt;array misscountc (&amp;amp;chars.) (&amp;amp;chars.*0);&lt;/P&gt;
&lt;P&gt;do i=1 to dim(num);&lt;BR /&gt;if num(i) = . then misscountn(i) + 1;&lt;BR /&gt;end;&lt;BR /&gt;do i=1 to dim(chars);&lt;BR /&gt;if chars(i) = '' then misscountc(i) + 1;&lt;BR /&gt;end;&lt;/P&gt;
&lt;P&gt;if end=1 then do;&lt;BR /&gt; do i= 1 to dim(num);&lt;BR /&gt; percentmiss= misscountn(i) / obsnum ;&lt;BR /&gt; var=(vname(num(i)));&lt;BR /&gt; output;&lt;BR /&gt; end;&lt;BR /&gt; do i= 1 to dim(chars);&lt;BR /&gt; percentmiss= misscountc(i) / obsnum ;&lt;BR /&gt; var=(vname(chars(i)));&lt;BR /&gt; output;&lt;BR /&gt; end;&lt;BR /&gt;end;&lt;BR /&gt;keep percentmiss var;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Oct 2015 19:40:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Report-on-missing-values-of-each-coloumn/m-p/228982#M41390</guid>
      <dc:creator>michelle_delaurentis_sas_com</dc:creator>
      <dc:date>2015-10-07T19:40:51Z</dc:date>
    </item>
  </channel>
</rss>

