<?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 can I Change Background Color On Summary Line in Microsoft Integration with SAS</title>
    <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/How-can-I-Change-Background-Color-On-Summary-Line/m-p/48637#M721</link>
    <description>Hi:&lt;BR /&gt;
  I don't know how it works with DDE, but with PROC REPORT, it is simple to tell SAS to make the summary line a different color. You don't have to count up rows because SAS knows how many rows there are.&lt;BR /&gt;
&lt;BR /&gt;
  In the code below, I had to make some fake data so that every STATE would have a different number of observations. For the first PROC REPORT, I made a separate sheet for every STATE. For the second PROC REPORT, I put all 3 STATES in one worksheet with a blank line between each group.&lt;BR /&gt;
 &lt;BR /&gt;
  cynthia&lt;BR /&gt;
[pre]&lt;BR /&gt;
data prdsale;&lt;BR /&gt;
  set sashelp.prdsale;&lt;BR /&gt;
  where region = 'EAST' and prodtype = 'OFFICE' and&lt;BR /&gt;
        product in ('DESK');&lt;BR /&gt;
  yearmonth= put(month,yymmdd5.);&lt;BR /&gt;
  if country = 'CANADA' then state = 'California';&lt;BR /&gt;
  else if country = 'GERMANY' then state='Georgia';&lt;BR /&gt;
  else state = 'New York';&lt;BR /&gt;
                  &lt;BR /&gt;
** make some other variables for the report -- just fake data;&lt;BR /&gt;
  state2 = state;&lt;BR /&gt;
  yearmonth2 = yearmonth;&lt;BR /&gt;
  recs_sent = int(actual / 33);&lt;BR /&gt;
  recs_rtnd = int(predict / 15);&lt;BR /&gt;
  ae_obtnd = round(ranuni(0)*30,1);&lt;BR /&gt;
  ssc_dual_obtnd = round(ranuni(0)*4,1);&lt;BR /&gt;
  tot_cost=actual;&lt;BR /&gt;
  costperrede=predict;&lt;BR /&gt;
  ** get different rows for differen values of state;&lt;BR /&gt;
  if state = 'Georgia' and quarter in (1,3,4) then delete;&lt;BR /&gt;
  if year = 1993 and state = 'California' then delete;&lt;BR /&gt;
  if year = 1993 and state = 'New York' then delete;&lt;BR /&gt;
  output;&lt;BR /&gt;
run;&lt;BR /&gt;
                             &lt;BR /&gt;
ods listing close;&lt;BR /&gt;
             &lt;BR /&gt;
proc sort data=prdsale out=prdsale;&lt;BR /&gt;
by State DESCENDING YearMonth;&lt;BR /&gt;
run;&lt;BR /&gt;
                               &lt;BR /&gt;
ods tagsets.excelxp file='color_sum1.xls' style=sasweb&lt;BR /&gt;
    options(sheet_name='Wombat');&lt;BR /&gt;
                             &lt;BR /&gt;
proc report data=prdsale nowd&lt;BR /&gt;
     style(header)={background=cx6b8e23 foreground=black};&lt;BR /&gt;
  title '1) Getting a separate Worksheet for Every BY Group';&lt;BR /&gt;
  by state;&lt;BR /&gt;
  column state2 yearmonth2 state yearmonth recs_sent recs_rtnd &lt;BR /&gt;
         ae_obtnd ssc_dual_obtnd tot_cost costperrede;&lt;BR /&gt;
  define state2 / display 'State';&lt;BR /&gt;
  define yearmonth2 / display 'Year Month' style(column)={cellwidth=1in};&lt;BR /&gt;
  define state / order noprint;&lt;BR /&gt;
  define yearmonth / order order=data noprint;&lt;BR /&gt;
  define recs_sent / mean 'Records Sent';&lt;BR /&gt;
  define recs_rtnd / mean;&lt;BR /&gt;
  define ae_obtnd / mean;&lt;BR /&gt;
  define ssc_dual_obtnd/mean;&lt;BR /&gt;
  define tot_cost / mean f=dollar15.2;&lt;BR /&gt;
  define costperrede/mean f=dollar15.2;&lt;BR /&gt;
  break after state/ summarize style={background=cx6b8e23};&lt;BR /&gt;
  compute after state;&lt;BR /&gt;
    state2 = 'Average';&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
run;&lt;BR /&gt;
               &lt;BR /&gt;
                                         &lt;BR /&gt;
ods tagsets.excelxp options(sheet_name='All Groups');&lt;BR /&gt;
                          &lt;BR /&gt;
proc report data=prdsale nowd&lt;BR /&gt;
     style(header)={background=cx6b8e23 foreground=black};&lt;BR /&gt;
  title '2) Getting All States in One Sheet with a separator line between each State';&lt;BR /&gt;
  column state2 yearmonth2 state yearmonth recs_sent recs_rtnd &lt;BR /&gt;
         ae_obtnd ssc_dual_obtnd tot_cost costperrede;&lt;BR /&gt;
  define state2 / display 'State';&lt;BR /&gt;
  define yearmonth2 / display 'Year Month' style(column)={cellwidth=1in};&lt;BR /&gt;
  define state / order noprint;&lt;BR /&gt;
  define yearmonth / order order=data noprint;&lt;BR /&gt;
  define recs_sent / mean 'Records Sent';&lt;BR /&gt;
  define recs_rtnd / mean;&lt;BR /&gt;
  define ae_obtnd / mean;&lt;BR /&gt;
  define ssc_dual_obtnd/mean;&lt;BR /&gt;
  define tot_cost / mean f=dollar15.2;&lt;BR /&gt;
  define costperrede/mean f=dollar15.2;&lt;BR /&gt;
  break after state/ summarize style={background=cx6b8e23};&lt;BR /&gt;
  compute after state ;&lt;BR /&gt;
    state2 = 'Average';&lt;BR /&gt;
    line ' ';&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
run;&lt;BR /&gt;
                          &lt;BR /&gt;
ods _all_ close;   &lt;BR /&gt;
[/pre]</description>
    <pubDate>Thu, 14 Apr 2011 23:28:36 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2011-04-14T23:28:36Z</dc:date>
    <item>
      <title>How can I Change Background Color On Summary Line</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/How-can-I-Change-Background-Color-On-Summary-Line/m-p/48636#M720</link>
      <description>I am producing an Excel spreadsheet using DDE.  How can I color the background of the summary line.  Can I do it while I write the line?  Plus how do I know which colors I can choose?  I'm looking for a Currency Green.&lt;BR /&gt;
&lt;BR /&gt;
One of the complexities is that the line numbers are dynamic because they will vary from run to run.&lt;BR /&gt;
&amp;amp;num is the number of data lines.&lt;BR /&gt;
&amp;amp;St_Cnt tells me how many break lines there are between the different states.&lt;BR /&gt;
+7 is that the Header ends on line 7.&lt;BR /&gt;
&lt;BR /&gt;
Here's my code:&lt;BR /&gt;
&lt;BR /&gt;
FILENAME Rpt1 DDE "Excel|&amp;amp;PathIn.\[STM_ROI_Template.xlsx]STM_ROI!R8C1:R%eval(&amp;amp;num.+7+&amp;amp;St_Cnt.+1)C16" notab;&lt;BR /&gt;
Data _NULL_;&lt;BR /&gt;
  file Rpt1;&lt;BR /&gt;
  set Formulas  end=EOF;&lt;BR /&gt;
  by State DESCENDING YearMonth;&lt;BR /&gt;
  Put State '09'x&lt;BR /&gt;
      YearMonth '09'x&lt;BR /&gt;
      Recs_Sent '09'x&lt;BR /&gt;
      AE_Recs_Sent '09'x&lt;BR /&gt;
      AE_Recs_Rtnd '09'x&lt;BR /&gt;
      Recs_Rtnd '09'x&lt;BR /&gt;
      Recs_Updtd '09'x&lt;BR /&gt;
      AE_Obtnd '09'x&lt;BR /&gt;
      SSC_Dual_Obtnd '09'x&lt;BR /&gt;
      Tot_Dts_Obtnd '09'x&lt;BR /&gt;
      PctUpdtdRecs '09'x&lt;BR /&gt;
      CostPerRede '09'x&lt;BR /&gt;
      Tot_Cost '09'x&lt;BR /&gt;
      Val_Dts_Obtnd '09'x&lt;BR /&gt;
      PctGain '09'x&lt;BR /&gt;
      ROI '09'x&lt;BR /&gt;
      ;&lt;BR /&gt;
  if last.State and not EOF&lt;BR /&gt;
  then do;&lt;BR /&gt;
          adjust_amt+1;&lt;BR /&gt;
          Put ' ' '09'x ' ' '09'x ' ' '09'x ' ' '09'x ' ' '09'x &lt;BR /&gt;
              ' ' '09'x ' ' '09'x ' ' '09'x ' ' '09'x ' ' '09'x &lt;BR /&gt;
              ' ' '09'x ' ' '09'x ' ' '09'x ' ' '09'x ' ' '09'x ' ';&lt;BR /&gt;
       end;&lt;BR /&gt;
  if EOF&lt;BR /&gt;
  then do;&lt;BR /&gt;
          Put 'AVERAGE' '09'x ' ' '09'x &lt;BR /&gt;
              "=AVERAGE(C8:C%eval(&amp;amp;num.+7+&amp;amp;St_Cnt.-1))" '09'x &lt;BR /&gt;
              "=AVERAGE(D8:D%eval(&amp;amp;num.+7+&amp;amp;St_Cnt.-1))" '09'x &lt;BR /&gt;
              "=AVERAGE(E8:E%eval(&amp;amp;num.+7+&amp;amp;St_Cnt.-1))" '09'x &lt;BR /&gt;
              "=AVERAGE(F8:F%eval(&amp;amp;num.+7+&amp;amp;St_Cnt.-1))" '09'x&lt;BR /&gt;
              "=AVERAGE(G8:G%eval(&amp;amp;num.+7+&amp;amp;St_Cnt.-1))" '09'x &lt;BR /&gt;
              "=AVERAGE(H8:H%eval(&amp;amp;num.+7+&amp;amp;St_Cnt.-1))" '09'x &lt;BR /&gt;
              "=AVERAGE(I8:I%eval(&amp;amp;num.+7+&amp;amp;St_Cnt.-1))" '09'x &lt;BR /&gt;
              "=$H%eval(&amp;amp;num.+7+&amp;amp;St_Cnt.)+$I%eval(&amp;amp;num.+7+&amp;amp;St_Cnt.)" '09'x &lt;BR /&gt;
              "=$J%eval(&amp;amp;num.+7+&amp;amp;St_Cnt.)/$G%eval(&amp;amp;num.+7+&amp;amp;St_Cnt.)" '09'x &lt;BR /&gt;
              "=$M%eval(&amp;amp;num.+7+&amp;amp;St_Cnt.)/$J%eval(&amp;amp;num.+7+&amp;amp;St_Cnt.)" '09'x&lt;BR /&gt;
			  '=$B$2' '09'x &lt;BR /&gt;
			  "=($H%eval(&amp;amp;num.+7+&amp;amp;St_Cnt.)+($I%eval(&amp;amp;num.+7+&amp;amp;St_Cnt.)*$B$3))*$B$1" '09'x &lt;BR /&gt;
              "=$P%eval(&amp;amp;num.+7+&amp;amp;St_Cnt.)/$M%eval(&amp;amp;num.+7+&amp;amp;St_Cnt.)" '09'x &lt;BR /&gt;
              "=$N%eval(&amp;amp;num.+7+&amp;amp;St_Cnt.)-$M%eval(&amp;amp;num.+7+&amp;amp;St_Cnt.)"&lt;BR /&gt;
          ;&lt;BR /&gt;
       end;&lt;BR /&gt;
run;</description>
      <pubDate>Tue, 12 Apr 2011 18:29:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/How-can-I-Change-Background-Color-On-Summary-Line/m-p/48636#M720</guid>
      <dc:creator>SAS_Doctor</dc:creator>
      <dc:date>2011-04-12T18:29:15Z</dc:date>
    </item>
    <item>
      <title>Re: How can I Change Background Color On Summary Line</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/How-can-I-Change-Background-Color-On-Summary-Line/m-p/48637#M721</link>
      <description>Hi:&lt;BR /&gt;
  I don't know how it works with DDE, but with PROC REPORT, it is simple to tell SAS to make the summary line a different color. You don't have to count up rows because SAS knows how many rows there are.&lt;BR /&gt;
&lt;BR /&gt;
  In the code below, I had to make some fake data so that every STATE would have a different number of observations. For the first PROC REPORT, I made a separate sheet for every STATE. For the second PROC REPORT, I put all 3 STATES in one worksheet with a blank line between each group.&lt;BR /&gt;
 &lt;BR /&gt;
  cynthia&lt;BR /&gt;
[pre]&lt;BR /&gt;
data prdsale;&lt;BR /&gt;
  set sashelp.prdsale;&lt;BR /&gt;
  where region = 'EAST' and prodtype = 'OFFICE' and&lt;BR /&gt;
        product in ('DESK');&lt;BR /&gt;
  yearmonth= put(month,yymmdd5.);&lt;BR /&gt;
  if country = 'CANADA' then state = 'California';&lt;BR /&gt;
  else if country = 'GERMANY' then state='Georgia';&lt;BR /&gt;
  else state = 'New York';&lt;BR /&gt;
                  &lt;BR /&gt;
** make some other variables for the report -- just fake data;&lt;BR /&gt;
  state2 = state;&lt;BR /&gt;
  yearmonth2 = yearmonth;&lt;BR /&gt;
  recs_sent = int(actual / 33);&lt;BR /&gt;
  recs_rtnd = int(predict / 15);&lt;BR /&gt;
  ae_obtnd = round(ranuni(0)*30,1);&lt;BR /&gt;
  ssc_dual_obtnd = round(ranuni(0)*4,1);&lt;BR /&gt;
  tot_cost=actual;&lt;BR /&gt;
  costperrede=predict;&lt;BR /&gt;
  ** get different rows for differen values of state;&lt;BR /&gt;
  if state = 'Georgia' and quarter in (1,3,4) then delete;&lt;BR /&gt;
  if year = 1993 and state = 'California' then delete;&lt;BR /&gt;
  if year = 1993 and state = 'New York' then delete;&lt;BR /&gt;
  output;&lt;BR /&gt;
run;&lt;BR /&gt;
                             &lt;BR /&gt;
ods listing close;&lt;BR /&gt;
             &lt;BR /&gt;
proc sort data=prdsale out=prdsale;&lt;BR /&gt;
by State DESCENDING YearMonth;&lt;BR /&gt;
run;&lt;BR /&gt;
                               &lt;BR /&gt;
ods tagsets.excelxp file='color_sum1.xls' style=sasweb&lt;BR /&gt;
    options(sheet_name='Wombat');&lt;BR /&gt;
                             &lt;BR /&gt;
proc report data=prdsale nowd&lt;BR /&gt;
     style(header)={background=cx6b8e23 foreground=black};&lt;BR /&gt;
  title '1) Getting a separate Worksheet for Every BY Group';&lt;BR /&gt;
  by state;&lt;BR /&gt;
  column state2 yearmonth2 state yearmonth recs_sent recs_rtnd &lt;BR /&gt;
         ae_obtnd ssc_dual_obtnd tot_cost costperrede;&lt;BR /&gt;
  define state2 / display 'State';&lt;BR /&gt;
  define yearmonth2 / display 'Year Month' style(column)={cellwidth=1in};&lt;BR /&gt;
  define state / order noprint;&lt;BR /&gt;
  define yearmonth / order order=data noprint;&lt;BR /&gt;
  define recs_sent / mean 'Records Sent';&lt;BR /&gt;
  define recs_rtnd / mean;&lt;BR /&gt;
  define ae_obtnd / mean;&lt;BR /&gt;
  define ssc_dual_obtnd/mean;&lt;BR /&gt;
  define tot_cost / mean f=dollar15.2;&lt;BR /&gt;
  define costperrede/mean f=dollar15.2;&lt;BR /&gt;
  break after state/ summarize style={background=cx6b8e23};&lt;BR /&gt;
  compute after state;&lt;BR /&gt;
    state2 = 'Average';&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
run;&lt;BR /&gt;
               &lt;BR /&gt;
                                         &lt;BR /&gt;
ods tagsets.excelxp options(sheet_name='All Groups');&lt;BR /&gt;
                          &lt;BR /&gt;
proc report data=prdsale nowd&lt;BR /&gt;
     style(header)={background=cx6b8e23 foreground=black};&lt;BR /&gt;
  title '2) Getting All States in One Sheet with a separator line between each State';&lt;BR /&gt;
  column state2 yearmonth2 state yearmonth recs_sent recs_rtnd &lt;BR /&gt;
         ae_obtnd ssc_dual_obtnd tot_cost costperrede;&lt;BR /&gt;
  define state2 / display 'State';&lt;BR /&gt;
  define yearmonth2 / display 'Year Month' style(column)={cellwidth=1in};&lt;BR /&gt;
  define state / order noprint;&lt;BR /&gt;
  define yearmonth / order order=data noprint;&lt;BR /&gt;
  define recs_sent / mean 'Records Sent';&lt;BR /&gt;
  define recs_rtnd / mean;&lt;BR /&gt;
  define ae_obtnd / mean;&lt;BR /&gt;
  define ssc_dual_obtnd/mean;&lt;BR /&gt;
  define tot_cost / mean f=dollar15.2;&lt;BR /&gt;
  define costperrede/mean f=dollar15.2;&lt;BR /&gt;
  break after state/ summarize style={background=cx6b8e23};&lt;BR /&gt;
  compute after state ;&lt;BR /&gt;
    state2 = 'Average';&lt;BR /&gt;
    line ' ';&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
run;&lt;BR /&gt;
                          &lt;BR /&gt;
ods _all_ close;   &lt;BR /&gt;
[/pre]</description>
      <pubDate>Thu, 14 Apr 2011 23:28:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/How-can-I-Change-Background-Color-On-Summary-Line/m-p/48637#M721</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2011-04-14T23:28:36Z</dc:date>
    </item>
  </channel>
</rss>

