<?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 How to get zero counts of required combinations ? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-zero-counts-of-required-combinations/m-p/678226#M204681</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a&amp;nbsp; sample dataset as below&amp;nbsp; with many records and tried the following code to get zero counts with required combinations&amp;nbsp; , but am getting all the possible combinations along with&amp;nbsp; the relevant group, even though&amp;nbsp; those records doesn't belong to that group.Is there anyway I can get the desired output as stated below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc format;&lt;BR /&gt;value $sc(notsorted)&lt;BR /&gt;"low"="low"&lt;BR /&gt;"medium"="medium"&lt;BR /&gt;"high"="high";&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;data test;&lt;BR /&gt;infile cards;&lt;BR /&gt;input cat $ code $ score $;&lt;BR /&gt;cards;&lt;BR /&gt;c1 a11 low &lt;BR /&gt;c1 b11 medium&lt;BR /&gt;c2 e12 low &lt;BR /&gt;c2 h13 medium&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;data test2;&lt;BR /&gt;set test;&lt;BR /&gt;format score $sc.;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc summary data=test2 nway completetypes;&lt;BR /&gt;class cat code score/preloadfmt;&lt;BR /&gt;output out=test_cnts;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture_dat.PNG" style="width: 365px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/48468i71AD92A012B96EC2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Capture_dat.PNG" alt="Capture_dat.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need the output only with rows of respective by group, as below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Desired output:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;c1&amp;nbsp; a11 high&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/P&gt;
&lt;P&gt;c1&amp;nbsp; a11&amp;nbsp; low&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;
&lt;P&gt;c1&amp;nbsp; a11&amp;nbsp; medium&amp;nbsp; &amp;nbsp; 0&lt;/P&gt;
&lt;P&gt;c1&amp;nbsp; b11 high&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/P&gt;
&lt;P&gt;c1&amp;nbsp; b11&amp;nbsp; low&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/P&gt;
&lt;P&gt;c1&amp;nbsp; b11&amp;nbsp; medium&amp;nbsp; &amp;nbsp; 1&lt;/P&gt;
&lt;P&gt;c2&amp;nbsp; e12 high&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/P&gt;
&lt;P&gt;c2&amp;nbsp; e12&amp;nbsp; low&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;
&lt;P&gt;c2&amp;nbsp; e12&amp;nbsp; medium&amp;nbsp; &amp;nbsp; 0&lt;/P&gt;
&lt;P&gt;c2 h13 high&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/P&gt;
&lt;P&gt;c2 h13 low&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/P&gt;
&lt;P&gt;c2 h13 medium&amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Highly appreciate your input&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 20 Aug 2020 19:19:22 GMT</pubDate>
    <dc:creator>sri1</dc:creator>
    <dc:date>2020-08-20T19:19:22Z</dc:date>
    <item>
      <title>How to get zero counts of required combinations ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-zero-counts-of-required-combinations/m-p/678226#M204681</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a&amp;nbsp; sample dataset as below&amp;nbsp; with many records and tried the following code to get zero counts with required combinations&amp;nbsp; , but am getting all the possible combinations along with&amp;nbsp; the relevant group, even though&amp;nbsp; those records doesn't belong to that group.Is there anyway I can get the desired output as stated below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc format;&lt;BR /&gt;value $sc(notsorted)&lt;BR /&gt;"low"="low"&lt;BR /&gt;"medium"="medium"&lt;BR /&gt;"high"="high";&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;data test;&lt;BR /&gt;infile cards;&lt;BR /&gt;input cat $ code $ score $;&lt;BR /&gt;cards;&lt;BR /&gt;c1 a11 low &lt;BR /&gt;c1 b11 medium&lt;BR /&gt;c2 e12 low &lt;BR /&gt;c2 h13 medium&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;data test2;&lt;BR /&gt;set test;&lt;BR /&gt;format score $sc.;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc summary data=test2 nway completetypes;&lt;BR /&gt;class cat code score/preloadfmt;&lt;BR /&gt;output out=test_cnts;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture_dat.PNG" style="width: 365px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/48468i71AD92A012B96EC2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Capture_dat.PNG" alt="Capture_dat.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need the output only with rows of respective by group, as below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Desired output:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;c1&amp;nbsp; a11 high&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/P&gt;
&lt;P&gt;c1&amp;nbsp; a11&amp;nbsp; low&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;
&lt;P&gt;c1&amp;nbsp; a11&amp;nbsp; medium&amp;nbsp; &amp;nbsp; 0&lt;/P&gt;
&lt;P&gt;c1&amp;nbsp; b11 high&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/P&gt;
&lt;P&gt;c1&amp;nbsp; b11&amp;nbsp; low&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/P&gt;
&lt;P&gt;c1&amp;nbsp; b11&amp;nbsp; medium&amp;nbsp; &amp;nbsp; 1&lt;/P&gt;
&lt;P&gt;c2&amp;nbsp; e12 high&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/P&gt;
&lt;P&gt;c2&amp;nbsp; e12&amp;nbsp; low&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;
&lt;P&gt;c2&amp;nbsp; e12&amp;nbsp; medium&amp;nbsp; &amp;nbsp; 0&lt;/P&gt;
&lt;P&gt;c2 h13 high&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/P&gt;
&lt;P&gt;c2 h13 low&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/P&gt;
&lt;P&gt;c2 h13 medium&amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Highly appreciate your input&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Aug 2020 19:19:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-zero-counts-of-required-combinations/m-p/678226#M204681</guid>
      <dc:creator>sri1</dc:creator>
      <dc:date>2020-08-20T19:19:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to get zero counts of required combinations ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-zero-counts-of-required-combinations/m-p/678241#M204685</link>
      <description>&lt;P&gt;For this data one way but can get pretty cumbersome for larger specific combinations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt; 

proc summary data=test2 nway completetypes;
class cat code score/preloadfmt;
output out=test_cnts (where= ( (cat='c1' and code in ('a11' 'b11')) OR
                               (cat='c2' and code in ('e12' 'h13')) 
                             )
                     )
;
run;&lt;/PRE&gt;
&lt;P&gt;Another is to create a data set with the combinations of values you want and use the Exclusive=thatdatasetname.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Aug 2020 19:50:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-zero-counts-of-required-combinations/m-p/678241#M204685</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-08-20T19:50:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to get zero counts of required combinations ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-zero-counts-of-required-combinations/m-p/678286#M204696</link>
      <description>&lt;P&gt;Another way:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
infile cards;
input cat $ code $ score $;
cards;
c1 a11 low
c1 b11 medium
c2 e12 low
c2 h13 high
run;

proc sql;
  select a.CAT, a.CODE, b.SCORE, c.SCORE=b.SCORE
  from (select CAT, CODE from TEST)     a
         full join
       (select unique SCORE from TEST)  b 
         on 1
         left join 
       TEST                              c
         on a.CAT=c.CAT and a.CODE=c.CODE
  order by 1,2; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;DIV class="branch"&gt;&lt;A name="IDX" target="_blank"&gt;&lt;/A&gt;
&lt;DIV&gt;
&lt;DIV align="left"&gt;
&lt;TABLE class="table" summary="Procedure SQL: Query Results" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;&lt;COLGROUP&gt; &lt;COL /&gt; &lt;COL /&gt; &lt;COL /&gt; &lt;COL /&gt;&lt;/COLGROUP&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="l b header" scope="col"&gt;cat&lt;/TH&gt;
&lt;TH class="l b header" scope="col"&gt;code&lt;/TH&gt;
&lt;TH class="l b header" scope="col"&gt;score&lt;/TH&gt;
&lt;TH class="r b header" scope="col"&gt;&amp;nbsp;&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;c1&lt;/TD&gt;
&lt;TD class="l data"&gt;a11&lt;/TD&gt;
&lt;TD class="l data"&gt;low&lt;/TD&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;c1&lt;/TD&gt;
&lt;TD class="l data"&gt;a11&lt;/TD&gt;
&lt;TD class="l data"&gt;medium&lt;/TD&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;c1&lt;/TD&gt;
&lt;TD class="l data"&gt;a11&lt;/TD&gt;
&lt;TD class="l data"&gt;high&lt;/TD&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;c1&lt;/TD&gt;
&lt;TD class="l data"&gt;b11&lt;/TD&gt;
&lt;TD class="l data"&gt;medium&lt;/TD&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;c1&lt;/TD&gt;
&lt;TD class="l data"&gt;b11&lt;/TD&gt;
&lt;TD class="l data"&gt;low&lt;/TD&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;c1&lt;/TD&gt;
&lt;TD class="l data"&gt;b11&lt;/TD&gt;
&lt;TD class="l data"&gt;high&lt;/TD&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;c2&lt;/TD&gt;
&lt;TD class="l data"&gt;e12&lt;/TD&gt;
&lt;TD class="l data"&gt;high&lt;/TD&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;c2&lt;/TD&gt;
&lt;TD class="l data"&gt;e12&lt;/TD&gt;
&lt;TD class="l data"&gt;medium&lt;/TD&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;c2&lt;/TD&gt;
&lt;TD class="l data"&gt;e12&lt;/TD&gt;
&lt;TD class="l data"&gt;low&lt;/TD&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;c2&lt;/TD&gt;
&lt;TD class="l data"&gt;h13&lt;/TD&gt;
&lt;TD class="l data"&gt;medium&lt;/TD&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;c2&lt;/TD&gt;
&lt;TD class="l data"&gt;h13&lt;/TD&gt;
&lt;TD class="l data"&gt;low&lt;/TD&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;c2&lt;/TD&gt;
&lt;TD class="l data"&gt;h13&lt;/TD&gt;
&lt;TD class="l data"&gt;high&lt;/TD&gt;
&lt;TD class="r data"&gt;1&lt;/TD&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>Thu, 20 Aug 2020 22:39:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-zero-counts-of-required-combinations/m-p/678286#M204696</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-08-20T22:39:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to get zero counts of required combinations ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-zero-counts-of-required-combinations/m-p/678686#M204864</link>
      <description>Thanks for reply. This may work for small dataset with minimal combinations but a dataset with hundreds of records it’s bit complex ... Would appreciate if you can post the other way you said with exclusive= datasetname</description>
      <pubDate>Sat, 22 Aug 2020 18:05:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-zero-counts-of-required-combinations/m-p/678686#M204864</guid>
      <dc:creator>sri1</dc:creator>
      <dc:date>2020-08-22T18:05:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to get zero counts of required combinations ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-zero-counts-of-required-combinations/m-p/678687#M204870</link>
      <description>Thanks for reply. I am not sure whether this code works for the dataset posted as it doesn’t have a record with score “high”</description>
      <pubDate>Sat, 22 Aug 2020 18:11:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-zero-counts-of-required-combinations/m-p/678687#M204870</guid>
      <dc:creator>sri1</dc:creator>
      <dc:date>2020-08-22T18:11:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to get zero counts of required combinations ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-zero-counts-of-required-combinations/m-p/678711#M204889</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/80196"&gt;@sri1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thanks for reply. This may work for small dataset with minimal combinations but a dataset with hundreds of records it’s bit complex ... Would appreciate if you can post the other way you said with exclusive= datasetname&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I am not sure what the requirement is?&amp;nbsp; Do you want all possible combinations or just some of them?&amp;nbsp; If the later can you explain the rules for which combinations you want?&lt;/P&gt;</description>
      <pubDate>Sun, 23 Aug 2020 01:00:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-zero-counts-of-required-combinations/m-p/678711#M204889</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-08-23T01:00:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to get zero counts of required combinations ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-zero-counts-of-required-combinations/m-p/678726#M204900</link>
      <description>I just need the combinations of respective by group such as below&lt;BR /&gt;&lt;BR /&gt;C1 a11  low&lt;BR /&gt;C1  a11 medium&lt;BR /&gt;C1  a11 high&lt;BR /&gt;C1  b11 low&lt;BR /&gt;C1  b11 medium&lt;BR /&gt;C1  b11 high&lt;BR /&gt;C2  e12 low&lt;BR /&gt;C2  e12 medium &lt;BR /&gt;C2  e12 high&lt;BR /&gt;C2   h13 low&lt;BR /&gt;C2   h13 medium&lt;BR /&gt;c2    h13 high</description>
      <pubDate>Sun, 23 Aug 2020 06:43:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-zero-counts-of-required-combinations/m-p/678726#M204900</guid>
      <dc:creator>sri1</dc:creator>
      <dc:date>2020-08-23T06:43:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to get zero counts of required combinations ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-zero-counts-of-required-combinations/m-p/678748#M204911</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/80196"&gt;@sri1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I just need the combinations of respective by group such as below&lt;BR /&gt;&lt;BR /&gt;C1 a11 low&lt;BR /&gt;C1 a11 medium&lt;BR /&gt;C1 a11 high&lt;BR /&gt;C1 b11 low&lt;BR /&gt;C1 b11 medium&lt;BR /&gt;C1 b11 high&lt;BR /&gt;C2 e12 low&lt;BR /&gt;C2 e12 medium &lt;BR /&gt;C2 e12 high&lt;BR /&gt;C2 h13 low&lt;BR /&gt;C2 h13 medium&lt;BR /&gt;c2 h13 high&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So I think you are saying you want the ACTUAL values of the first two and the possible values of the third.&amp;nbsp; So use the posted code by PROC SUMMARY but use BY for the first two variables and CLASS for the third with COMPLETETYPES and PRELOADFMT options.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=test nway completetypes;
 by cat code ;
 class score/preloadfmt;
 output out=test_cnts;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 23 Aug 2020 14:01:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-zero-counts-of-required-combinations/m-p/678748#M204911</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-08-23T14:01:29Z</dc:date>
    </item>
  </channel>
</rss>

