<?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: Report in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Report/m-p/708752#M217851</link>
    <description>&lt;P&gt;Why are you using&amp;nbsp; "sum" in proc report&amp;nbsp; when you just need to display the table ?&lt;/P&gt;
&lt;P&gt;for pct you use display and for rows and ind99 you use sum,&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt; define rows / sum f=comma4. color=yellow;&lt;BR /&gt;define ind99 / sum f=comma4. color=blue;&lt;BR /&gt;define pct / display f=percent6. color=green;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 30 Dec 2020 12:49:45 GMT</pubDate>
    <dc:creator>Ronein</dc:creator>
    <dc:date>2020-12-30T12:49:45Z</dc:date>
    <item>
      <title>Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Report/m-p/708721#M217843</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I want to create summary report as following:&lt;/P&gt;
&lt;P&gt;column 1: Year&lt;/P&gt;
&lt;P&gt;column 2: status&lt;/P&gt;
&lt;P&gt;column 3 :Number of rows in team=1&lt;/P&gt;
&lt;P&gt;column 4 :Number of rows in team=1 with ind99=1&lt;/P&gt;
&lt;P&gt;column 5 : PCT of&amp;nbsp; column4/column3&lt;/P&gt;
&lt;P&gt;column 6 :Number of rows in team=2&lt;BR /&gt;column 7 :Number of rows in team=2 with ind99=1&lt;BR /&gt;column 8 : PCT of&amp;nbsp; column7/column6&lt;/P&gt;
&lt;P&gt;column 9 :Number of rows in team=3&lt;BR /&gt;column 10 :Number of rows in team=3 with ind99=1&lt;BR /&gt;column 11 : PCT of&amp;nbsp; column10/column9&lt;/P&gt;
&lt;P&gt;I also want to have total row.&lt;/P&gt;
&lt;P&gt;I want that columns headers be in light grey background.&lt;/P&gt;
&lt;P&gt;I want that columns&amp;nbsp; 3,6,9 will be in yellow background&lt;/P&gt;
&lt;P&gt;I want that columns&amp;nbsp; 4,7,10 will be in blue&amp;nbsp; background&lt;/P&gt;
&lt;P&gt;I want that columns&amp;nbsp; 5,8,11 will be in green&amp;nbsp; background&lt;/P&gt;
&lt;P&gt;I want that the report be dynamic so if there are more teams(More then 3 teams) then the report will still be created well&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data rawtbl;
Input year ID team  status $ Ind99;
cards;
2020 1 1 Y 0
2020 2 1 Y 1
2020 3 1 N 0
2020 4 3 N 0
2020 5 2 Y 0
2020 6 2 Y 1
2020 7 2 Y 1
2020 8 2 Y 0
2020 9 3 Y 0
2020 10 3 N 0
2019 1 2 Y 1
2019 2 1 Y 0
2019 3 1 Y 0
2019 4 1 N 1
2019 5 1 N 1
2019 6 2 Y 1
2019 7 2 Y 0
2019 8 3 Y 0
2019 9 3 N 0
2019 10 3 N 1
;
Run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Dec 2020 08:13:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Report/m-p/708721#M217843</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2020-12-30T08:13:02Z</dc:date>
    </item>
    <item>
      <title>Re: Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Report/m-p/708724#M217845</link>
      <description>&lt;P&gt;I'm using SAS UE and cannot test colors.&lt;/P&gt;
&lt;P&gt;Try next code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=rawtbl nway noprint;
  class year status team;
  var ind99;
  output out=tbl(drop=_type_ rename=(_freq_=rows)) sum=;
run;

data want;
 set tbl;
     pct = ind99/rows;
     format pct percent6.2;
run;

proc report data=want;
  columns year status team rows ind99 pct;
  define year / order;
  define status / order;
  define team / order;
  define rows / sum f=comma4. color=yellow;
  define ind99 / sum f=comma4. color=blue;
  define pct / display f=percent6. color=green;
run;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Dec 2020 09:40:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Report/m-p/708724#M217845</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2020-12-30T09:40:21Z</dc:date>
    </item>
    <item>
      <title>Re: Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Report/m-p/708744#M217847</link>
      <description>&lt;P&gt;Alternative code creates a color report:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=rawtbl nway noprint;
  class year status team;
  var ind99;
  output out=tbl(drop=_type_ rename=(_freq_=rows)) sum=;
run;

proc report data=tbl;
  columns year status team rows ind99 pct;
  define year / order;
  define status / order;
  define team / order;
  define rows / sum f=comma4. style={backgroundcolor=yellow};
  define ind99 / sum f=comma4. style={backgroundcolor=cyan};
  define pct / computed f=percent6. "PCT" style={backgroundcolor=lightgreen};
  
compute pct;
  pct=sum(ind99.sum / rows.sum);
endcomp;

compute after;
   status='Total';  /* must be a char type column variable */
endcomp;

rbreak after /summarize;  /* report summary */
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Dec 2020 12:15:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Report/m-p/708744#M217847</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2020-12-30T12:15:43Z</dc:date>
    </item>
    <item>
      <title>Re: Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Report/m-p/708751#M217850</link>
      <description>&lt;P&gt;And which colours to use for teams 4 to 42?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Dec 2020 12:46:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Report/m-p/708751#M217850</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2020-12-30T12:46:40Z</dc:date>
    </item>
    <item>
      <title>Re: Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Report/m-p/708752#M217851</link>
      <description>&lt;P&gt;Why are you using&amp;nbsp; "sum" in proc report&amp;nbsp; when you just need to display the table ?&lt;/P&gt;
&lt;P&gt;for pct you use display and for rows and ind99 you use sum,&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt; define rows / sum f=comma4. color=yellow;&lt;BR /&gt;define ind99 / sum f=comma4. color=blue;&lt;BR /&gt;define pct / display f=percent6. color=green;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Dec 2020 12:49:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Report/m-p/708752#M217851</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2020-12-30T12:49:45Z</dc:date>
    </item>
    <item>
      <title>Re: Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Report/m-p/708755#M217853</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Why are you using&amp;nbsp; "sum" in proc report&amp;nbsp; when you just need to display the table ?&lt;/P&gt;
&lt;P&gt;for pct you use display and for rows and ind99 you use sum,&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt; define rows / sum f=comma4. color=yellow;&lt;BR /&gt;define ind99 / sum f=comma4. color=blue;&lt;BR /&gt;define pct / display f=percent6. color=green;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Rows contains frequency. Sum is used for the Total row.&lt;/P&gt;
&lt;P&gt;Ind99 contains 1 or 0; Thus sum result in total number of rows with ind99=1;&lt;/P&gt;
&lt;P&gt;PCT is already computed per group and need be computed for the Total row.&lt;/P&gt;
&lt;P&gt;It cannot be summed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may try change SUM to DISPLAY and check how should proc report relate to it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Dec 2020 13:26:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Report/m-p/708755#M217853</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2020-12-30T13:26:56Z</dc:date>
    </item>
  </channel>
</rss>

