<?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: proc freq: how to include levels with frequencies equaling 0 in your output in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-freq-how-to-include-levels-with-frequencies-equaling-0-in/m-p/683078#M206836</link>
    <description>Thanks, this did help.</description>
    <pubDate>Thu, 10 Sep 2020 21:03:20 GMT</pubDate>
    <dc:creator>hein68</dc:creator>
    <dc:date>2020-09-10T21:03:20Z</dc:date>
    <item>
      <title>proc freq: how to include levels with frequencies equaling 0 in your output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-freq-how-to-include-levels-with-frequencies-equaling-0-in/m-p/683013#M206808</link>
      <description>&lt;P&gt;When using proc freq, what code is needed to &lt;FONT style="background-color: #ffffff;"&gt;include levels with frequencies equaling 0 in your output?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2020 17:58:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-freq-how-to-include-levels-with-frequencies-equaling-0-in/m-p/683013#M206808</guid>
      <dc:creator>hein68</dc:creator>
      <dc:date>2020-09-10T17:58:57Z</dc:date>
    </item>
    <item>
      <title>Re: proc freq: how to include levels with frequencies equaling 0 in your output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-freq-how-to-include-levels-with-frequencies-equaling-0-in/m-p/683042#M206816</link>
      <description>So you have a value but that value doesn't appear anywhere in your data and you want SAS to put a 0 for that unknown value?&lt;BR /&gt;&lt;BR /&gt;You can look into PRELOADFMT or CLASSDATA within PROC TABULATE/MEANS which deal with this better but a quick trick for PROC FREQ is to use the SPARSE option. BUT...it only works if that value is listed at least once within other categories.&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/sastraining/2013/10/18/sas-authors-tip-using-the-sparse-option-with-proc-freq/" target="_blank"&gt;https://blogs.sas.com/content/sastraining/2013/10/18/sas-authors-tip-using-the-sparse-option-with-proc-freq/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.pharmasug.org/proceedings/2012/CC/PharmaSUG-2012-CC26.pdf" target="_blank"&gt;https://www.pharmasug.org/proceedings/2012/CC/PharmaSUG-2012-CC26.pdf&lt;/A&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 10 Sep 2020 19:16:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-freq-how-to-include-levels-with-frequencies-equaling-0-in/m-p/683042#M206816</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-09-10T19:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: proc freq: how to include levels with frequencies equaling 0 in your output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-freq-how-to-include-levels-with-frequencies-equaling-0-in/m-p/683043#M206817</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/74483"&gt;@hein68&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;When using proc freq, what code is needed to &lt;FONT style="background-color: #ffffff;"&gt;include levels with frequencies equaling 0 in your output?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I think you need to be a bit more detailed in your question such as providing some example data and exactly what "level" that has a frequency of 0 that should be counted.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you talking about a combination of variables or a single variable?&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2020 19:18:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-freq-how-to-include-levels-with-frequencies-equaling-0-in/m-p/683043#M206817</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-09-10T19:18:11Z</dc:date>
    </item>
    <item>
      <title>Re: proc freq: how to include levels with frequencies equaling 0 in your output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-freq-how-to-include-levels-with-frequencies-equaling-0-in/m-p/683067#M206828</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/74483"&gt;@hein68&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another trick is to use the &lt;A href="https://documentation.sas.com/?docsetId=procstat&amp;amp;docsetTarget=procstat_freq_syntax13.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank" rel="noopener"&gt;WEIGHT statement&lt;/A&gt; with the ZEROS option:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Create test data for demonstration */

data have;
set sashelp.class;
run;

/* Introduce age levels with frequency zero */

data want / view=want;
do until(last);
  set have end=last;
  _w=1;
  output;
end;
do age=5, 18, 99;
  _w=0;
  output;
end;
run;

/* Create frequency table including the new levels */

proc freq data=want;
weight _w / zeros;
tables age;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Output:&lt;/P&gt;
&lt;PRE&gt;                                Cumulative    Cumulative
Age    Frequency     Percent     Frequency      Percent
--------------------------------------------------------
  5           0        0.00             0         0.00
 11           2       10.53             2        10.53
 12           5       26.32             7        36.84
 13           3       15.79            10        52.63
 14           4       21.05            14        73.68
 15           4       21.05            18        94.74
 16           1        5.26            19       100.00
 18           0        0.00            19       100.00
 99           0        0.00            19       100.00&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 Sep 2020 20:17:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-freq-how-to-include-levels-with-frequencies-equaling-0-in/m-p/683067#M206828</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2020-09-10T20:17:35Z</dc:date>
    </item>
    <item>
      <title>Re: proc freq: how to include levels with frequencies equaling 0 in your output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-freq-how-to-include-levels-with-frequencies-equaling-0-in/m-p/683078#M206836</link>
      <description>Thanks, this did help.</description>
      <pubDate>Thu, 10 Sep 2020 21:03:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-freq-how-to-include-levels-with-frequencies-equaling-0-in/m-p/683078#M206836</guid>
      <dc:creator>hein68</dc:creator>
      <dc:date>2020-09-10T21:03:20Z</dc:date>
    </item>
  </channel>
</rss>

