<?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: How to get Subgroups with Null Frequency with PROC SQL COUNT(*) GROUP BY in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-Subgroups-with-Null-Frequency-with-PROC-SQL-COUNT/m-p/405986#M98799</link>
    <description>&lt;P&gt;If all values are listed in your data set somewhere you can use PROC FREQ with the SPARSE option.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If not, then you need to use another solution. Basically if it doesn't exist in the data, how does SAS know it even exists? In this case you can use either CLASSDATA or PRELOADFMT or a more manual solution via DATA STEP or PROC SQL.&lt;/P&gt;</description>
    <pubDate>Fri, 20 Oct 2017 15:13:12 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-10-20T15:13:12Z</dc:date>
    <item>
      <title>How to get Subgroups with Null Frequency with PROC SQL COUNT(*) GROUP BY</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-Subgroups-with-Null-Frequency-with-PROC-SQL-COUNT/m-p/405732#M98733</link>
      <description>&lt;P&gt;Hello !&lt;/P&gt;&lt;P&gt;Hope you're doing well guys .&lt;/P&gt;&lt;P&gt;I'm working on a&amp;nbsp; SAS table which contains two categorical variables : Var_a&amp;nbsp; Var_b&amp;nbsp; and i m trying to execute the query below via PROC SQL&lt;/P&gt;&lt;PRE&gt;PROC SQL ; 
SELECT var_a , var_b , COUNT(*) AS Frequency 
FROM MyTable 
GROUP BY var_a , var_b ; 
QUIT ; &lt;/PRE&gt;&lt;P&gt;The problem is i do only get subgroups for which Frequency &amp;gt;0&lt;/P&gt;&lt;P&gt;Is there any option for PROC SQL to get all the subgroups even those with FREQUENCY = 0 .&lt;/P&gt;&lt;P&gt;Thanks for Help !&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2017 20:46:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-Subgroups-with-Null-Frequency-with-PROC-SQL-COUNT/m-p/405732#M98733</guid>
      <dc:creator>Raitag</dc:creator>
      <dc:date>2017-10-19T20:46:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to get Subgroups with Null Frequency with PROC SQL COUNT(*) GROUP BY</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-Subgroups-with-Null-Frequency-with-PROC-SQL-COUNT/m-p/405740#M98736</link>
      <description>&lt;P&gt;Use a cross join (cartesian product) to get all class combinations:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select a.sex,
       b.age,
       count(c.name) as n
from 
    (select unique sex from sashelp.class) as a cross join
    (select unique age from sashelp.class) as b left join
    sashelp.class as c on a.sex=c.sex and b.age=c.age
group by a.sex, b.age;
quit;

 &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Oct 2017 21:26:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-Subgroups-with-Null-Frequency-with-PROC-SQL-COUNT/m-p/405740#M98736</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-10-19T21:26:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to get Subgroups with Null Frequency with PROC SQL COUNT(*) GROUP BY</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-Subgroups-with-Null-Frequency-with-PROC-SQL-COUNT/m-p/405741#M98737</link>
      <description>&lt;P&gt;Any particular reason the solution has to be SQL?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc freq data=mytable;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; tables var_a*var_b/ list missing;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2017 21:27:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-Subgroups-with-Null-Frequency-with-PROC-SQL-COUNT/m-p/405741#M98737</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-10-19T21:27:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to get Subgroups with Null Frequency with PROC SQL COUNT(*) GROUP BY</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-Subgroups-with-Null-Frequency-with-PROC-SQL-COUNT/m-p/405986#M98799</link>
      <description>&lt;P&gt;If all values are listed in your data set somewhere you can use PROC FREQ with the SPARSE option.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If not, then you need to use another solution. Basically if it doesn't exist in the data, how does SAS know it even exists? In this case you can use either CLASSDATA or PRELOADFMT or a more manual solution via DATA STEP or PROC SQL.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Oct 2017 15:13:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-Subgroups-with-Null-Frequency-with-PROC-SQL-COUNT/m-p/405986#M98799</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-10-20T15:13:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to get Subgroups with Null Frequency with PROC SQL COUNT(*) GROUP BY</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-Subgroups-with-Null-Frequency-with-PROC-SQL-COUNT/m-p/408924#M99873</link>
      <description>&lt;P&gt;Thank you so much for your help.&lt;/P&gt;&lt;P&gt;Here what i did&amp;nbsp; : I used proc summary with&amp;nbsp; completetypes option with adding preloadfmt option to the class statement and it worked perfectly &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Oct 2017 22:19:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-Subgroups-with-Null-Frequency-with-PROC-SQL-COUNT/m-p/408924#M99873</guid>
      <dc:creator>Raitag</dc:creator>
      <dc:date>2017-10-30T22:19:36Z</dc:date>
    </item>
  </channel>
</rss>

