<?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(calldef) unexpected impact on call define ...style/merge... result in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/style-calldef-unexpected-impact-on-call-define-style-merge/m-p/732965#M24974</link>
    <description>&lt;P&gt;Indeed, changing the order in the column statement affect the result. I didn't notice that.&lt;/P&gt;&lt;P&gt;But do you understand why, given style/merge is used?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Unexpected result&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;My code before&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 style(calldef)=[foreground=white]; 
    columns name sex age height weight ; 
    define name--weight / display;
    
    compute sex;
        if sex='M' then call define ('name' ,'style','style=[background=lightblue]');
    endcomp;

    compute age;
        if age=12 then call define ('name' ,'style/merge'  ,'style=[foreground=red]');
    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="result1.JPG" style="width: 278px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/57391i290A443A35096F4D/image-size/large?v=v2&amp;amp;px=999" role="button" title="result1.JPG" alt="result1.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Expected result&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Putting age before sex (and just for consistency, putting compute age... style, before compute sex style/merge&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 style(calldef)=[foreground=white]; 
    columns name  age sex height weight ; 
    define name--weight / display;
    
    compute age;
        if age=12 then call define ('name' ,'style'  ,'style=[foreground=red]');
    endcomp;
    
    compute sex;
        if sex='M' then call define ('name' ,'style/merge','style=[background=lightblue]');
    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="result2.JPG" style="width: 274px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/57392iEFD3ED8CDD75A3A3/image-size/large?v=v2&amp;amp;px=999" role="button" title="result2.JPG" alt="result2.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using style/merge in both compute statements would not change the result.&lt;/P&gt;</description>
    <pubDate>Mon, 12 Apr 2021 08:55:48 GMT</pubDate>
    <dc:creator>xxformat_com</dc:creator>
    <dc:date>2021-04-12T08:55:48Z</dc:date>
    <item>
      <title>style(calldef) unexpected impact on call define ...style/merge... result</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/style-calldef-unexpected-impact-on-call-define-style-merge/m-p/732908#M24969</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was wondering why the &lt;STRONG&gt;style/merge&lt;/STRONG&gt; does not provide the same result when &lt;STRONG&gt;style(calldef)&lt;/STRONG&gt; is activated.&lt;/P&gt;&lt;P&gt;Is it a bug or is there another reason behind this result?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc report data=sashelp.class;* style(calldef)=[foreground=white]; 
    columns name sex age height weight ; 
    define name--weight / display;
    
    compute sex;
        if sex='M' then call define ('name' ,'style','style=[background=lightblue]');
    endcomp;

    compute age;
        if age=12 then call define ('name' ,'style/merge'  ,'style=[foreground=red]');
    endcomp;
run;

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ps. as requested I had the picture when &lt;CODE class=" language-sas"&gt;* style(calldef)=[foreground=white]; &lt;/CODE&gt;&amp;nbsp;is activated&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="with_calldef.JPG" style="width: 272px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/57390i575ECAA32AD24104/image-size/large?v=v2&amp;amp;px=999" role="button" title="with_calldef.JPG" alt="with_calldef.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Apr 2021 08:35:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/style-calldef-unexpected-impact-on-call-define-style-merge/m-p/732908#M24969</guid>
      <dc:creator>xxformat_com</dc:creator>
      <dc:date>2021-04-12T08:35:38Z</dc:date>
    </item>
    <item>
      <title>Re: style(calldef) unexpected impact on call define ...style/merge... result</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/style-calldef-unexpected-impact-on-call-define-style-merge/m-p/732923#M24970</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; That's odd. The code you posted worked for me. I limited the rows to ages 12 and 13 to make for a better screen shot. In my output, all the males have a blue background and the rows where age is 12 have a red foreground color:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cynthia_sas_0-1618186141832.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/57380i0AC1C8FFFDAC8E6B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cynthia_sas_0-1618186141832.png" alt="Cynthia_sas_0-1618186141832.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Note how the rows for Jane and Louise have a red foreground color, but NOT a blue background color which I expect because they are 12 and they are female. On the other hand, all the rows for males do have a blue background color and the rows for James, John and Robert -- all 12 year old males have a blue background and a red foreground. I added the title to show my version of SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; I don't have any other versions of SAS to test with, so you might want to open a track with Tech Support.&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Mon, 12 Apr 2021 00:12:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/style-calldef-unexpected-impact-on-call-define-style-merge/m-p/732923#M24970</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2021-04-12T00:12:44Z</dc:date>
    </item>
    <item>
      <title>Re: style(calldef) unexpected impact on call define ...style/merge... result</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/style-calldef-unexpected-impact-on-call-define-style-merge/m-p/732929#M24971</link>
      <description>&lt;P&gt;Hi Cynthia,&lt;BR /&gt;The code works for me too for as long as style(calldef) is not used.&lt;BR /&gt;Have you tested it when style(calldef) is activated in proc report statement?&lt;BR /&gt;Best Regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ps.&lt;/P&gt;&lt;DIV class="sasSource"&gt;Current version: 9.04.01M5P091317&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;Operating System: WX64_WKS.&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Apr 2021 08:39:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/style-calldef-unexpected-impact-on-call-define-style-merge/m-p/732929#M24971</guid>
      <dc:creator>xxformat_com</dc:creator>
      <dc:date>2021-04-12T08:39:18Z</dc:date>
    </item>
    <item>
      <title>Re: style(calldef) unexpected impact on call define ...style/merge... result</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/style-calldef-unexpected-impact-on-call-define-style-merge/m-p/732950#M24972</link>
      <description>&lt;P&gt;I strongly suggest that you explicitly state what values are appearing in the manner that you do not expect. By NAME and AGE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that the order of the variables SEX and AGE on the column statement changes the result.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Apr 2021 05:01:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/style-calldef-unexpected-impact-on-call-define-style-merge/m-p/732950#M24972</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-04-12T05:01:36Z</dc:date>
    </item>
    <item>
      <title>Re: style(calldef) unexpected impact on call define ...style/merge... result</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/style-calldef-unexpected-impact-on-call-define-style-merge/m-p/732962#M24973</link>
      <description>Thanks. I've now added the unexpected result in the main post.</description>
      <pubDate>Mon, 12 Apr 2021 08:37:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/style-calldef-unexpected-impact-on-call-define-style-merge/m-p/732962#M24973</guid>
      <dc:creator>xxformat_com</dc:creator>
      <dc:date>2021-04-12T08:37:11Z</dc:date>
    </item>
    <item>
      <title>Re: style(calldef) unexpected impact on call define ...style/merge... result</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/style-calldef-unexpected-impact-on-call-define-style-merge/m-p/732965#M24974</link>
      <description>&lt;P&gt;Indeed, changing the order in the column statement affect the result. I didn't notice that.&lt;/P&gt;&lt;P&gt;But do you understand why, given style/merge is used?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Unexpected result&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;My code before&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 style(calldef)=[foreground=white]; 
    columns name sex age height weight ; 
    define name--weight / display;
    
    compute sex;
        if sex='M' then call define ('name' ,'style','style=[background=lightblue]');
    endcomp;

    compute age;
        if age=12 then call define ('name' ,'style/merge'  ,'style=[foreground=red]');
    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="result1.JPG" style="width: 278px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/57391i290A443A35096F4D/image-size/large?v=v2&amp;amp;px=999" role="button" title="result1.JPG" alt="result1.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Expected result&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Putting age before sex (and just for consistency, putting compute age... style, before compute sex style/merge&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 style(calldef)=[foreground=white]; 
    columns name  age sex height weight ; 
    define name--weight / display;
    
    compute age;
        if age=12 then call define ('name' ,'style'  ,'style=[foreground=red]');
    endcomp;
    
    compute sex;
        if sex='M' then call define ('name' ,'style/merge','style=[background=lightblue]');
    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="result2.JPG" style="width: 274px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/57392iEFD3ED8CDD75A3A3/image-size/large?v=v2&amp;amp;px=999" role="button" title="result2.JPG" alt="result2.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using style/merge in both compute statements would not change the result.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Apr 2021 08:55:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/style-calldef-unexpected-impact-on-call-define-style-merge/m-p/732965#M24974</guid>
      <dc:creator>xxformat_com</dc:creator>
      <dc:date>2021-04-12T08:55:48Z</dc:date>
    </item>
    <item>
      <title>Re: style(calldef) unexpected impact on call define ...style/merge... result</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/style-calldef-unexpected-impact-on-call-define-style-merge/m-p/732996#M24975</link>
      <description>&lt;PRE&gt;proc report data=sashelp.class nowd; 
    columns name  age sex height weight ; 
    define name--weight / display;
    
    compute sex;
	    if sex='M' then do;
              call define ('name' ,'style'  ,'style=[background=lightblue foreground=white ]'); 
			  if age=12  then call define ('name' ,'style','style=[background=lightblue  foreground=red]');
		end;
		else   if age=12  then call define ('name' ,'style','style=[foreground=red]');

    endcomp;
run;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Apr 2021 12:31:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/style-calldef-unexpected-impact-on-call-define-style-merge/m-p/732996#M24975</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-04-12T12:31:26Z</dc:date>
    </item>
    <item>
      <title>Re: style(calldef) unexpected impact on call define ...style/merge... result</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/style-calldef-unexpected-impact-on-call-define-style-merge/m-p/733028#M24976</link>
      <description>&lt;P&gt;Hi:&lt;BR /&gt;I don't understand the purpose of the foreground=white on the CALLDEF override on the PROC REPORT statement. What were you trying to achieve when putting the override in the PROC REPORT statement? When you change the foreground to white, which would cause it to match the background? If you want to change the foreground to white when the background is blue, that would be better to do in the COMPUTE block where you're changing that background. I think you're running into a timing issue with PROC REPORT and the style overrides. I think in the long run you'd be better off NOT using the style override in the PROC REPORT statement and just delaying the compute block as late as possible by doing it on the last variable on the report row -- that way, after all the items are place on the report row, PROC REPORT only has to go back once and fiddle with the style override for the NAME cell. I'll see if I can come up with something that allows you to maintain your original order. I think with a revised IF in a COMPUTE block for WEIGHT, it can work and you won't need to use STYLE/MERGE.&lt;BR /&gt;Cynthia&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Well, I could make it work with the override in the PROC REPORT statement and still maintain the original order of variables. I prefer the alternative example, because in the long run, I think it will be easier to maintain.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cynthia_sas_0-1618245724667.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/57412iABDC98A4D46295E6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cynthia_sas_0-1618245724667.png" alt="Cynthia_sas_0-1618245724667.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Apr 2021 16:42:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/style-calldef-unexpected-impact-on-call-define-style-merge/m-p/733028#M24976</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2021-04-12T16:42:15Z</dc:date>
    </item>
    <item>
      <title>Re: style(calldef) unexpected impact on call define ...style/merge... result</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/style-calldef-unexpected-impact-on-call-define-style-merge/m-p/733042#M24977</link>
      <description>&lt;P&gt;Still haven't seen an explicit list of which values are "misbehaving" in terms of what you expect or want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As a minimum you have two overrides going on, the Style(calldef) and then the compute blocks. Order of application is likely the issue between "conflicting" overrides. I don't know if there is anything in the documentation of which will "win" when there is a conflict. Generally I expect the lowest granularity override to appear, i.e. the compute block version over one set for the procedure. But interactions?? Which is why I have asked for the specific values that you are concerned about. Yes the values change. But which ones do you want to appear how has not been answered.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Apr 2021 17:03:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/style-calldef-unexpected-impact-on-call-define-style-merge/m-p/733042#M24977</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-04-12T17:03:23Z</dc:date>
    </item>
    <item>
      <title>Re: style(calldef) unexpected impact on call define ...style/merge... result</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/style-calldef-unexpected-impact-on-call-define-style-merge/m-p/739444#M24992</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;After further investigations, here are my reasoning. Do you agree?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="5"&gt;Part 1 - without &lt;CODE&gt;style(calldef)&lt;/CODE&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example 1: using &lt;CODE&gt;'style'&lt;/CODE&gt; in the second argument of &lt;CODE&gt;compute age&lt;/CODE&gt; block.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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;
    columns name sex age height weight ; 
    define name--weight / display;
    
    compute sex;
        if sex='M' then call define ('name' ,'style','style=[foreground=lightblue]');
    endcomp;

    compute age;
        if age=12 then call define ('name' ,&lt;STRONG&gt;'style'&lt;/STRONG&gt;  ,'style=[foreground=red]');
    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="xxformat_1.JPG" style="width: 270px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/59088i21FB57500B9DCCFD/image-size/large?v=v2&amp;amp;px=999" role="button" title="xxformat_1.JPG" alt="xxformat_1.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To start with foreground=lightblue when gender=M.&lt;/P&gt;&lt;P&gt;Then,&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;when &lt;CODE&gt;gender='M'&lt;/CODE&gt; and &lt;CODE&gt;age=12&lt;/CODE&gt; then the &lt;CODE&gt;foreground&lt;/CODE&gt; is changed to &lt;CODE&gt;red&lt;/CODE&gt; &lt;STRONG&gt;(&lt;CODE&gt;John&lt;/CODE&gt; is now in &lt;CODE&gt;red&lt;/CODE&gt;)&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;when &lt;CODE&gt;gender ne 'M'&lt;/CODE&gt; and &lt;CODE&gt;age=12&lt;/CODE&gt; then the &lt;CODE&gt;foreground&lt;/CODE&gt; which was not yet defined is set to &lt;CODE&gt;red&lt;/CODE&gt;.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example 2: using &lt;CODE&gt;'style/merge'&lt;/CODE&gt; in the second argument of the &lt;CODE&gt;compute age&lt;/CODE&gt; block.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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;
    columns name sex age height weight ; 
    define name--weight / display;
    
    compute sex;
        if sex='M' then call define ('name' ,'style','style=[foreground=lightblue]');
    endcomp;

    compute age;
        if age=12 then call define ('name' ,&lt;STRONG&gt;'style/merge'&lt;/STRONG&gt;  ,'style=[foreground=red]');
    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="xxformat_2.JPG" style="width: 276px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/59089i4F7D9C853C368B02/image-size/large?v=v2&amp;amp;px=999" role="button" title="xxformat_2.JPG" alt="xxformat_2.JPG" /&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;To start with &lt;CODE&gt;foreground=lightblue&lt;/CODE&gt; when &lt;CODE&gt;gender=M&lt;/CODE&gt;.&lt;/P&gt;&lt;P&gt;Then,&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;when &lt;CODE&gt;gender='M'&lt;/CODE&gt; and &lt;CODE&gt;age=12&lt;/CODE&gt; then &lt;CODE&gt;foreground&lt;/CODE&gt; remains &lt;CODE&gt;lightblue&lt;/CODE&gt; &lt;STRONG&gt;(&lt;CODE&gt;John&lt;/CODE&gt; is still in &lt;CODE&gt;lightblue&lt;/CODE&gt;)&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;when &lt;CODE&gt;gender ne 'M'&lt;/CODE&gt; and &lt;CODE&gt;age=12&lt;/CODE&gt; then the &lt;CODE&gt;foreground&lt;/CODE&gt; which was not yet defined is set to &lt;CODE&gt;red&lt;/CODE&gt;.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From these extra two examples, we understand that&lt;/P&gt;&lt;P&gt;- rule 1: for a given cell, the value of a given option is replaced when &lt;CODE&gt;'style'&lt;/CODE&gt; (or &lt;CODE&gt;'style/replace'&lt;/CODE&gt;) is used&lt;/P&gt;&lt;P&gt;- rule 2: for a given cell, the value of the already defined option is not changed when &lt;CODE&gt;'style/merge'&lt;/CODE&gt; is used&lt;/P&gt;&lt;P&gt;These conclusions don't apply to &lt;CODE&gt;style(calldef)&lt;/CODE&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example 3: using a mix of &lt;CODE&gt;background=&lt;/CODE&gt; and &lt;CODE&gt;foreground=&lt;/CODE&gt; as well as &lt;CODE&gt;'style'&lt;/CODE&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What we didn't see in example 1, was that &lt;CODE&gt;'style'&lt;/CODE&gt; does not just reset the given option, but the whole cell.&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;
    columns name sex age height weight ; 
    define name--weight / display;
    
    compute sex;
        if sex='M' then call define ('name' ,'style','style=[background=lightblue]');
    endcomp;

    compute age;
        if age=12 then call define ('name' ,'style'  ,'style=[foreground=red]');
    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="xxformat_4.JPG" style="width: 275px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/59091i868B758FCC285C79/image-size/large?v=v2&amp;amp;px=999" role="button" title="xxformat_4.JPG" alt="xxformat_4.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In this example we see that John who had a light blue background to start with has now no background and a red foreground color.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example 4: using a mix of &lt;CODE&gt;background=&lt;/CODE&gt; and &lt;CODE&gt;foreground=&lt;/CODE&gt; as well as &lt;CODE&gt;'style/merge'&lt;/CODE&gt;&lt;/STRONG&gt;&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;
    columns name sex age height weight ; 
    define name--weight / display;
    
    compute sex;
        if sex='M' then call define ('name' ,'style','style=[&lt;STRONG&gt;background&lt;/STRONG&gt;=lightblue]');
    endcomp;

    compute age;
        if age=12 then call define ('name' ,&lt;STRONG&gt;'style/merge'&lt;/STRONG&gt;  ,'style=[&lt;STRONG&gt;foreground&lt;/STRONG&gt;=red]');
    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="xxformat_5.JPG" style="width: 272px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/59092i376A83E93FB37E73/image-size/large?v=v2&amp;amp;px=999" role="button" title="xxformat_5.JPG" alt="xxformat_5.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;When using &lt;CODE&gt;'style/merge'&lt;/CODE&gt;, only options which were not set for a given value are added.&lt;/P&gt;&lt;P&gt;For this reason &lt;CODE&gt;John&lt;/CODE&gt; keeps his &lt;CODE&gt;lightblue&lt;/CODE&gt; &lt;CODE&gt;background&lt;/CODE&gt; and get now a &lt;CODE&gt;red&lt;/CODE&gt; &lt;CODE&gt;foreground&lt;/CODE&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From these extra two examples, we understand that&lt;/P&gt;&lt;P&gt;- rule 1(updated): for a given cell, the value of &lt;STRONG&gt;all the options&lt;/STRONG&gt; is replaced when &lt;CODE&gt;'style'&lt;/CODE&gt; (or &lt;CODE&gt;'style/replace'&lt;/CODE&gt;) is used&lt;/P&gt;&lt;P&gt;- rule 2 (updated): for a given cell, the value of the already defined options is not changed when &lt;CODE&gt;'style/merge'&lt;/CODE&gt; is used&lt;/P&gt;&lt;P&gt;Those conclusions don't apply to &lt;CODE&gt;style(calldef)&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="5"&gt;Part 2 - with &lt;CODE&gt;style(calldef)&lt;/CODE&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example 5: using &lt;CODE&gt;style(calldef)&lt;/CODE&gt; and &lt;CODE&gt;'style'&lt;/CODE&gt;&lt;/STRONG&gt;&amp;nbsp;&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 &lt;STRONG&gt;style(calldef)=[foreground=white]&lt;/STRONG&gt;; 
    columns name sex age height weight ; 
    define name--weight / display;
    
    compute sex;
        if &lt;STRONG&gt;sex='M'&lt;/STRONG&gt; then call define ('name' ,&lt;STRONG&gt;'style'&lt;/STRONG&gt;,'style=[background=lightblue]');
    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="xxformat_3.JPG" style="width: 271px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/59090i1799970B60311955/image-size/large?v=v2&amp;amp;px=999" role="button" title="xxformat_3.JPG" alt="xxformat_3.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;style(calldef)&lt;/CODE&gt; only applies to values defined by &lt;CODE&gt;call define&lt;/CODE&gt; routines.&lt;/P&gt;&lt;P&gt;For this reason, &lt;CODE&gt;Alice&lt;/CODE&gt; is written in &lt;CODE&gt;black&lt;/CODE&gt; and not in &lt;CODE&gt;white&lt;/CODE&gt;.&lt;/P&gt;&lt;P&gt;Even if &lt;CODE&gt;'style'&lt;/CODE&gt; is used, the &lt;CODE&gt;white&lt;/CODE&gt; foreground is kept (not reset to &lt;CODE&gt;black&lt;/CODE&gt;).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example 6: using &lt;CODE&gt;style(calldef)&lt;/CODE&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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 style(calldef)=[foreground=white]; &lt;BR /&gt;columns name sex age height weight ; &lt;BR /&gt;define name--weight / display;&lt;BR /&gt;&lt;BR /&gt;compute sex;&lt;BR /&gt;*if sex='M' then call define ('name' ,'style','style=[foreground=lightblue]'); &lt;BR /&gt;if sex='M' then call define ('name' ,'style/merge','style=[foreground=lightblue]');&lt;BR /&gt;endcomp;&lt;BR /&gt;run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="xxformat_4.JPG" style="width: 280px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/59094i6CA576226343A735/image-size/large?v=v2&amp;amp;px=999" role="button" title="xxformat_4.JPG" alt="xxformat_4.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Here foreground is used in both &lt;CODE&gt;style(calldef)&lt;/CODE&gt; and &lt;CODE&gt;call define&lt;/CODE&gt; routine.&lt;/P&gt;&lt;P&gt;The value given in call define has priority,&lt;STRONG&gt; even if &lt;CODE&gt;'style/merge'&lt;/CODE&gt; is used. That's the tricky part!&lt;/STRONG&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;&lt;P&gt;&lt;STRONG&gt;Example 7: the original example in this post series&lt;/STRONG&gt;&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 style(calldef)=[foreground=white]; 
    columns name sex age height weight ; 
    define name--weight / display;
    
    compute sex;
        if sex='M' then call define ('name' ,'style','style=[background=lightblue]');
    endcomp;

    compute age;
        if age=12 then call define ('name' ,'style/merge'  ,'style=[foreground=red]');
    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="xxformat_7.JPG" style="width: 276px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/59093i93FD7D80273F6547/image-size/large?v=v2&amp;amp;px=999" role="button" title="xxformat_7.JPG" alt="xxformat_7.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example 5 explains us why we have &lt;CODE&gt;white&lt;/CODE&gt; &lt;CODE&gt;foreground&lt;/CODE&gt; on &lt;CODE&gt;lightblue&lt;/CODE&gt; &lt;CODE&gt;background&lt;/CODE&gt;.&lt;/P&gt;&lt;P&gt;A &lt;CODE&gt;background&lt;/CODE&gt; and a &lt;CODE&gt;foreground&lt;/CODE&gt; is already defined when &lt;CODE&gt;gender='M'&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;So, given that &lt;CODE&gt;'style/merge'&lt;/CODE&gt; is used in the &lt;CODE&gt;compute age&lt;/CODE&gt; block, only females where &lt;CODE&gt;age=12&lt;/CODE&gt; get a &lt;CODE&gt;red&lt;/CODE&gt; &lt;CODE&gt;foreground&lt;/CODE&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note: Ballardw comment on the impact of the variables order in the &lt;CODE&gt;column &lt;/CODE&gt;statement is an additional extra point to keep in mind. Here my &lt;CODE&gt;compute&lt;/CODE&gt; blocks follow the same order as the one given in the &lt;CODE&gt;column&lt;/CODE&gt; statement.&lt;/P&gt;</description>
      <pubDate>Thu, 06 May 2021 11:00:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/style-calldef-unexpected-impact-on-call-define-style-merge/m-p/739444#M24992</guid>
      <dc:creator>xxformat_com</dc:creator>
      <dc:date>2021-05-06T11:00:12Z</dc:date>
    </item>
  </channel>
</rss>

