<?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: Add categories with no values into summary report based on proc format categories in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Add-categories-with-no-values-into-summary-report-based-on-proc/m-p/773353#M245665</link>
    <description>I need to work on the summary table that was created.......and add to him the desired categories</description>
    <pubDate>Mon, 11 Oct 2021 10:52:14 GMT</pubDate>
    <dc:creator>Ronein</dc:creator>
    <dc:date>2021-10-11T10:52:14Z</dc:date>
    <item>
      <title>Add categories with no values into summary report based on proc format categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-categories-with-no-values-into-summary-report-based-on-proc/m-p/773345#M245658</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;Lets say that I have created a summary table and the result is the summary table in the code below.&lt;/P&gt;
&lt;P&gt;The task is to add categories that appear in proc format into the summary table.&lt;/P&gt;
&lt;P&gt;What is the best and most useful way to do it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Desired table is&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A 10&lt;BR /&gt;B 30&lt;BR /&gt;C 0&lt;BR /&gt;D 0&lt;BR /&gt;E 20&lt;BR /&gt;F 0&lt;BR /&gt;G 80&lt;BR /&gt;H 0&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Summarytbl;
Input Category $ Value;
Cards;
A 10
B 30
E 20
G 80
;
Run


proc format;
value $FFF 
'A'='Reason_A'
'B'='Type B'
'C'='Unknown reason'
'D'='Reason D'
'E'='Issue E'
'F'='Task F'
'G'='Task G'
'H'='Task H'
;
Run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Oct 2021 10:33:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-categories-with-no-values-into-summary-report-based-on-proc/m-p/773345#M245658</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2021-10-11T10:33:13Z</dc:date>
    </item>
    <item>
      <title>Re: Add categories with no values into summary report based on proc format categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-categories-with-no-values-into-summary-report-based-on-proc/m-p/773347#M245659</link>
      <description>&lt;P&gt;Depends on how the summary table is created, proc summary e.g. has an option to create rows/columns for each value in a format. Please see the docs for details.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Oct 2021 10:41:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-categories-with-no-values-into-summary-report-based-on-proc/m-p/773347#M245659</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-10-11T10:41:50Z</dc:date>
    </item>
    <item>
      <title>Re: Add categories with no values into summary report based on proc format categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-categories-with-no-values-into-summary-report-based-on-proc/m-p/773348#M245660</link>
      <description>&lt;P&gt;Untested:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data = Summarytbl nway completetypes;
   class Category / preloadfmt;
   var Value;
   output out = want(drop = _:) sum=;
   format Category $FFF.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Oct 2021 10:42:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-categories-with-no-values-into-summary-report-based-on-proc/m-p/773348#M245660</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-10-11T10:42:34Z</dc:date>
    </item>
    <item>
      <title>Re: Add categories with no values into summary report based on proc format categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-categories-with-no-values-into-summary-report-based-on-proc/m-p/773352#M245664</link>
      <description>&lt;P&gt;Another idea, applicable if you can't change the process creating the summary dataset:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Summarytbl;
   length Category $ 1 Value 8;
   input Category $ Value;
   cards;
A 10
B 30
E 20
G 80
;
run;


proc format;
   value $FFF 
      'A'='Reason_A'
      'B'='Type B'
      'C'='Unknown reason'
      'D'='Reason D'
      'E'='Issue E'
      'F'='Task F'
      'G'='Task G'
      'H'='Task H'
   ;
run;


proc format cntlout= FormatDef(keep= Start rename=(Start = Category));
   select $FFF;
run;


data want;
   merge FormatDef SummaryTbl;
   by Category;
   
   Value = coalesce(Value, 0);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Oct 2021 10:49:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-categories-with-no-values-into-summary-report-based-on-proc/m-p/773352#M245664</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-10-11T10:49:54Z</dc:date>
    </item>
    <item>
      <title>Re: Add categories with no values into summary report based on proc format categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-categories-with-no-values-into-summary-report-based-on-proc/m-p/773353#M245665</link>
      <description>I need to work on the summary table that was created.......and add to him the desired categories</description>
      <pubDate>Mon, 11 Oct 2021 10:52:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-categories-with-no-values-into-summary-report-based-on-proc/m-p/773353#M245665</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2021-10-11T10:52:14Z</dc:date>
    </item>
    <item>
      <title>Re: Add categories with no values into summary report based on proc format categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-categories-with-no-values-into-summary-report-based-on-proc/m-p/773541#M245754</link>
      <description>&lt;P&gt;Then post the code you are using to create the summary table, if it is not proc summary.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Oct 2021 05:12:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-categories-with-no-values-into-summary-report-based-on-proc/m-p/773541#M245754</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-10-12T05:12:08Z</dc:date>
    </item>
  </channel>
</rss>

