<?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: style hierarchy using proc report in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/style-hierarchy-using-proc-report/m-p/572966#M161721</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt; If I set the details by hand, the result is only valid with the current definition of the current style. Not ideal.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 11 Jul 2019 23:13:47 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2019-07-11T23:13:47Z</dc:date>
    <item>
      <title>style hierarchy using proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/style-hierarchy-using-proc-report/m-p/572572#M161583</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;In the code below, the change in row background style seems to change the other style attributes too (the first column is no longer bold). Why is that?&lt;/P&gt;
&lt;P&gt;Also, how can I reestablish the first column's style (I'd rather avoid listing all the columns in the IF test and use _ROW_ instead)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc report data=SASHELP.CLASS(where=(AGE&amp;gt;13)) nowd ;
  columns OBS NAME ;
  define OBS / computed format=2. '#' style(column)=header;
  compute NAME;
    _OBS_ + 1;
    OBS = _OBS_; 

   * Attempt to only alter the background of some lines ;
   * if NAME=:'J' then call define(_ROW_,'style','style=[background=aliceblue]');

   * Attempt to restore column 1 ;
   * call define('_C1_','style','style=header');

  endcomp;
run; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 135px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30933iB25116C293AD7BF4/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2019 01:00:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/style-hierarchy-using-proc-report/m-p/572572#M161583</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-07-11T01:00:31Z</dc:date>
    </item>
    <item>
      <title>Re: style hierarchy using proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/style-hierarchy-using-proc-report/m-p/572649#M161621</link>
      <description>&lt;P&gt;SAS generated this:&lt;/P&gt;
&lt;PRE&gt;&amp;lt;tr&amp;gt;
&amp;lt;th class="r header" scope="col"&amp;gt;3&amp;lt;/th&amp;gt;
&amp;lt;td class="data"&amp;gt;Henry&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&amp;lt;tr&amp;gt;
&amp;lt;td class="r &lt;STRONG&gt;&lt;FONT color="#FF6600"&gt;data&lt;/FONT&gt;&lt;/STRONG&gt;" style="background-color: #f0f8ff"&amp;gt;4&amp;lt;/td&amp;gt;
&amp;lt;td class="data" style="background-color: #f0f8ff"&amp;gt;Janet&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;&lt;/PRE&gt;
&lt;P&gt;I can't see a reason to replace "header" with "data", seems to be a bug (or very special feature), unfortunately this happens in HTML, RTF and PDF. So it doesn't look like something happening by coincidence.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13549"&gt;@Cynthia_sas&lt;/a&gt; has an idea.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2019 10:30:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/style-hierarchy-using-proc-report/m-p/572649#M161621</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-07-11T10:30:12Z</dc:date>
    </item>
    <item>
      <title>Re: style hierarchy using proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/style-hierarchy-using-proc-report/m-p/572690#M161645</link>
      <description>&lt;P&gt;Chris,&lt;/P&gt;
&lt;P&gt;It looks like you need adjust it by hand . hmm.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc report data=SASHELP.CLASS(where=(AGE&amp;gt;13)) nowd ;
  columns OBS NAME ;
  define OBS / computed format=2. '#' style(column)={ backgroundcolor=cxedf2f9 fontweight=bold };
  compute NAME;
    _OBS_ + 1;
    OBS = _OBS_; 

   * Attempt to only alter the background of some lines ;
    if NAME=:'J' then call define(_ROW_,'style','style=[background=aliceblue]');

   * Attempt to restore column 1 ;
   * call define('_C1_','style','style=header');

  endcomp;

run; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Jul 2019 12:51:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/style-hierarchy-using-proc-report/m-p/572690#M161645</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-07-11T12:51:27Z</dc:date>
    </item>
    <item>
      <title>Re: style hierarchy using proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/style-hierarchy-using-proc-report/m-p/572692#M161646</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="x.png" style="width: 83px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30943iDD65ED411F25555E/image-size/large?v=v2&amp;amp;px=999" role="button" title="x.png" alt="x.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2019 12:55:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/style-hierarchy-using-proc-report/m-p/572692#M161646</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-07-11T12:55:13Z</dc:date>
    </item>
    <item>
      <title>Re: style hierarchy using proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/style-hierarchy-using-proc-report/m-p/572907#M161694</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; It might be easier to understand if you set different colors to see what wins:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="call_define_wins.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30995iAEF0D73E63B3C817/image-size/large?v=v2&amp;amp;px=999" role="button" title="call_define_wins.png" alt="call_define_wins.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First, the overall style template sets style attributes, in this case HTMLBLUE The class attributes for the STYLE section in the HTML are set here.. Then, DEFINE for OBS overrides what is in the STYLE template for that variable (OBS would usually be styled with the DATA element.) Then, what you have in the CALL DEFINE wins out in the end and overrides what is in the &amp;lt;TR&amp;gt; tags for the J rows. If you want to see header in the class attribute for the OBS and the NAME, then you have to code the CALL DEFINE as I show.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Basically, what you are coding in CALL DEFINE is going to win out over everything else in the row.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2019 19:28:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/style-hierarchy-using-proc-report/m-p/572907#M161694</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2019-07-11T19:28:51Z</dc:date>
    </item>
    <item>
      <title>Re: style hierarchy using proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/style-hierarchy-using-proc-report/m-p/572966#M161721</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt; If I set the details by hand, the result is only valid with the current definition of the current style. Not ideal.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2019 23:13:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/style-hierarchy-using-proc-report/m-p/572966#M161721</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-07-11T23:13:47Z</dc:date>
    </item>
    <item>
      <title>Re: style hierarchy using proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/style-hierarchy-using-proc-report/m-p/572972#M161723</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13549"&gt;@Cynthia_sas&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&amp;gt;&amp;nbsp;Basically, what you are coding in CALL DEFINE is going to win out over everything else in the row.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;But I am only coding the background, not the font weight.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&amp;gt;Since I said to start from the Header element....&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Even changing&amp;nbsp;the data element only changes the&amp;nbsp;header column:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;      if NAME=:'J' then call define(_ROW_,'style','style=data[background=aliceblue]');
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;I tried&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;      call define('_C1_','style','style=data[header]');
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;to recover the style in C1, but SAS spits out scary errors.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I guess the way to achieve&amp;nbsp;my desired result for now is to set the background&amp;nbsp;color&amp;nbsp;column by column.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This what I'll use unless something&amp;nbsp;better comes:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;     %macro loop; %local i; %do i=2 %to 10;
       if ... then call define("_C&amp;amp;i._",'style','style=data[background=aliceblue]');
      %end; %mend;%loop;   
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;Also, w&lt;/SPAN&gt;&lt;SPAN&gt;asn't there a way to set column/row style override?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you all!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2019 23:44:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/style-hierarchy-using-proc-report/m-p/572972#M161723</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-07-11T23:44:23Z</dc:date>
    </item>
  </channel>
</rss>

