<?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 Proc SQL display all categories in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-display-all-categories/m-p/285235#M58261</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
 SELECT programtypeid, COUNT(childid) AS NewEnroll_ByCou_YTD
  FROM counts
  where '01jan2016'd &amp;lt;= dateeval &amp;lt;= &amp;amp;tdate
  group by programtypeid;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Gives me this output:&lt;/P&gt;&lt;P&gt;SAS Output&lt;/P&gt;&lt;DIV class="branch"&gt;&lt;DIV&gt;&lt;DIV align="center"&gt;Neighborhoods NewEnroll_ByCou_YTD &lt;TABLE cellspacing="0" cellpadding="5"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Central Bronx&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Bronx Park and Fordham&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;High Bridge and Morrisania&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Hunts Point and Mott Haven&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Central Harlem&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Chelsea and Clinton&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;East Harlem&lt;/TD&gt;&lt;TD&gt;42&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;The Neighborhoods variable has 35 more categories and I would like them all listed, even if they are all zeros. Is there a way to do this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Mon, 18 Jul 2016 14:10:32 GMT</pubDate>
    <dc:creator>hwangnyc</dc:creator>
    <dc:date>2016-07-18T14:10:32Z</dc:date>
    <item>
      <title>Proc SQL display all categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-display-all-categories/m-p/285235#M58261</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
 SELECT programtypeid, COUNT(childid) AS NewEnroll_ByCou_YTD
  FROM counts
  where '01jan2016'd &amp;lt;= dateeval &amp;lt;= &amp;amp;tdate
  group by programtypeid;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Gives me this output:&lt;/P&gt;&lt;P&gt;SAS Output&lt;/P&gt;&lt;DIV class="branch"&gt;&lt;DIV&gt;&lt;DIV align="center"&gt;Neighborhoods NewEnroll_ByCou_YTD &lt;TABLE cellspacing="0" cellpadding="5"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Central Bronx&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Bronx Park and Fordham&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;High Bridge and Morrisania&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Hunts Point and Mott Haven&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Central Harlem&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Chelsea and Clinton&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;East Harlem&lt;/TD&gt;&lt;TD&gt;42&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;The Neighborhoods variable has 35 more categories and I would like them all listed, even if they are all zeros. Is there a way to do this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jul 2016 14:10:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-display-all-categories/m-p/285235#M58261</guid>
      <dc:creator>hwangnyc</dc:creator>
      <dc:date>2016-07-18T14:10:32Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL display all categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-display-all-categories/m-p/287402#M59134</link>
      <description>&lt;P&gt;The 35 neighborhoods&amp;nbsp;are not in the SAS table or they would have appeared.&lt;/P&gt;
&lt;P&gt;Unless you mean that are there but with other dates?&lt;/P&gt;
&lt;P&gt;In which case something like this&amp;nbsp;may do:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
   SELECT programtypeid, sum(   '01jan2016'd &amp;lt;= dateeval &amp;lt;= &amp;amp;tdate )   AS NewEnroll_ByCou_YTD
   FROM counts
   group by programtypeid;
QUIT;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Jul 2016 03:32:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-display-all-categories/m-p/287402#M59134</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2016-07-27T03:32:35Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL display all categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-display-all-categories/m-p/287421#M59140</link>
      <description>&lt;P&gt;Maybe the categories that they don't satify the condition they aren't listed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm going to write another possibility.&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="token procnames"&gt;PROC MEANS DATA=COUNTS NMISS N;&lt;BR /&gt;&lt;/SPAN&gt;ID programtypeid;&lt;BR /&gt;&lt;SPAN class="token punctuation"&gt;VAR &lt;/SPAN&gt;childid;&lt;BR /&gt;OUTPUT OUT=SALIDA(N=NewEnroll_ByCou_YTD);
RUN&lt;SPAN class="token punctuation"&gt;;&lt;BR /&gt;PROC SORT DATA=SALIDA;&lt;BR /&gt;BY PROGRAMTYPEID;&lt;BR /&gt;RUN;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;You should include your condition with WHERE;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2016 07:06:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-display-all-categories/m-p/287421#M59140</guid>
      <dc:creator>toconero</dc:creator>
      <dc:date>2016-07-27T07:06:09Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL display all categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-display-all-categories/m-p/287427#M59141</link>
      <description>&lt;P&gt;Do you have a format to transform &lt;EM&gt;programtypeid&lt;/EM&gt; to &lt;EM&gt;Neighborhoods&lt;/EM&gt;?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Untested, assuming that a format exists and is named $Neighborhoods:&lt;/P&gt;&lt;PRE&gt;proc summary data=counts(where=('01jan2016'd &amp;lt;= dateeval &amp;lt;= &amp;amp;tdate)) completetypes nway;
  class programtypeid / preloadfmt order=data;
  format programmtypeid $Neighborhoods.;
  output out=work.CountComplete(drop=_type_ rename=(_freq_=NewEnroll_ByCou_YTD));
run;

proc print data=work.CountComplete noobs;
run;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Jul 2016 07:30:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-display-all-categories/m-p/287427#M59141</guid>
      <dc:creator>error_prone</dc:creator>
      <dc:date>2016-07-27T07:30:07Z</dc:date>
    </item>
  </channel>
</rss>

