<?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: outputing a frequency count of 0 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/outputing-a-frequency-count-of-0/m-p/384888#M91994</link>
    <description>&lt;P&gt;Why do you need to use proc freq? &amp;nbsp;Proc freq provides counts of data&amp;nbsp;&lt;U&gt;which is present&lt;/U&gt;. &amp;nbsp;In most scenarios where I have to do this, then I merge the results back to the distinct list of options:&lt;/P&gt;
&lt;PRE&gt;proc sql;
  create table WANT as
  select  COALESCE(A.AGE_GROUP,B.AGE_GROUP) as AGE_GROUP,
          case when B.N=. then 0 else B.N end as N
  from    (select distinct AGE_GROUP from HAVE) A
  full join MEANS_OUTPUT B
  on      A.AGE_GROUP=B.AGE_GROUP;
quit;&lt;/PRE&gt;
&lt;P&gt;However, if you use the right procedure, proc means, then you can use nway (and also multi-label formats if you need to combinations and such like) and do it in one proc means step.&lt;/P&gt;</description>
    <pubDate>Wed, 02 Aug 2017 08:39:09 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2017-08-02T08:39:09Z</dc:date>
    <item>
      <title>outputing a frequency count of 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/outputing-a-frequency-count-of-0/m-p/384854#M91976</link>
      <description>&lt;P&gt;I have made a variable called age_group which has been dervied from an existing variable age. the variable age_group is split up as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;age_group=1 if age&amp;lt;35&lt;/P&gt;&lt;P&gt;age_group=2 if&amp;nbsp; 35&amp;lt;=age&amp;lt;=75&lt;/P&gt;&lt;P&gt;age_group=3 if age&amp;gt;75.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I run a proc freq on the data, age_group=3 does not appear in the output table because there are 0 observations of this in the data. I am wandering how I can get the proc freq to display a frequency of 0 for age_group=3.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2017 05:02:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/outputing-a-frequency-count-of-0/m-p/384854#M91976</guid>
      <dc:creator>BenBrady</dc:creator>
      <dc:date>2017-08-02T05:02:24Z</dc:date>
    </item>
    <item>
      <title>Re: outputing a frequency count of 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/outputing-a-frequency-count-of-0/m-p/384857#M91977</link>
      <description>&lt;P&gt;Check out this solution&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Procedures/PROC-FREQ-Include-Zero-Counts/td-p/325505" target="_blank"&gt;https://communities.sas.com/t5/SAS-Procedures/PROC-FREQ-Include-Zero-Counts/td-p/325505&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2017 05:11:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/outputing-a-frequency-count-of-0/m-p/384857#M91977</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-08-02T05:11:38Z</dc:date>
    </item>
    <item>
      <title>Re: outputing a frequency count of 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/outputing-a-frequency-count-of-0/m-p/384858#M91978</link>
      <description>&lt;P&gt;proc freq does not have an easy option for this, but proc means does. Do you need proc freq?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data CLASSES; 
  AGE=30; output; 
  AGE=60; output; 
  AGE=90; output; 
data HAVE; 
  AGE=60; output; 
  AGE=90; output; 
proc means data=HAVE classdata=CLASSES nway;
   class AGE;
   output out=FREQ;
run; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure Means: Summary statistics" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="r b header" scope="col"&gt;AGE&lt;/TH&gt;
&lt;TH class="r b header" scope="col"&gt;N Obs&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH class="r t data"&gt;30&lt;/TH&gt;
&lt;TH class="r t data"&gt;0&lt;/TH&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r t data"&gt;60&lt;/TH&gt;
&lt;TH class="r t data"&gt;1&lt;/TH&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r t data"&gt;90&lt;/TH&gt;
&lt;TH class="r t data"&gt;1&lt;/TH&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2017 05:17:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/outputing-a-frequency-count-of-0/m-p/384858#M91978</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2017-08-02T05:17:46Z</dc:date>
    </item>
    <item>
      <title>Re: outputing a frequency count of 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/outputing-a-frequency-count-of-0/m-p/384859#M91979</link>
      <description>yes I do need to use proc freq</description>
      <pubDate>Wed, 02 Aug 2017 05:26:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/outputing-a-frequency-count-of-0/m-p/384859#M91979</guid>
      <dc:creator>BenBrady</dc:creator>
      <dc:date>2017-08-02T05:26:17Z</dc:date>
    </item>
    <item>
      <title>Re: outputing a frequency count of 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/outputing-a-frequency-count-of-0/m-p/384888#M91994</link>
      <description>&lt;P&gt;Why do you need to use proc freq? &amp;nbsp;Proc freq provides counts of data&amp;nbsp;&lt;U&gt;which is present&lt;/U&gt;. &amp;nbsp;In most scenarios where I have to do this, then I merge the results back to the distinct list of options:&lt;/P&gt;
&lt;PRE&gt;proc sql;
  create table WANT as
  select  COALESCE(A.AGE_GROUP,B.AGE_GROUP) as AGE_GROUP,
          case when B.N=. then 0 else B.N end as N
  from    (select distinct AGE_GROUP from HAVE) A
  full join MEANS_OUTPUT B
  on      A.AGE_GROUP=B.AGE_GROUP;
quit;&lt;/PRE&gt;
&lt;P&gt;However, if you use the right procedure, proc means, then you can use nway (and also multi-label formats if you need to combinations and such like) and do it in one proc means step.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2017 08:39:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/outputing-a-frequency-count-of-0/m-p/384888#M91994</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-08-02T08:39:09Z</dc:date>
    </item>
  </channel>
</rss>

