<?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: COMPUTE BLOCK in PROC REPORT in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/COMPUTE-BLOCK-in-PROC-REPORT/m-p/728802#M226761</link>
    <description>&lt;P&gt;Thank you, Cynthia!&amp;nbsp; Your solution worked.&lt;/P&gt;</description>
    <pubDate>Wed, 24 Mar 2021 16:04:55 GMT</pubDate>
    <dc:creator>cgsmoak56</dc:creator>
    <dc:date>2021-03-24T16:04:55Z</dc:date>
    <item>
      <title>COMPUTE BLOCK in PROC REPORT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/COMPUTE-BLOCK-in-PROC-REPORT/m-p/728267#M226597</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following compute block that works just fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;compute dup_label;&lt;BR /&gt;&lt;BR /&gt;if dup_label = 'Y' then do;&lt;BR /&gt;call define(_COL_,"style","STYLE={background=#ffa500}");&lt;BR /&gt;end;&lt;BR /&gt;&lt;BR /&gt;endcomp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If there is a duplicate variable labels in the dataset, it shades the value of 'Y' in orange.&amp;nbsp; I would also like in the report to shade the variable name and variable label in orange when the value of dup_label = 'Y'.&amp;nbsp; I tried the following compute block, but it had no effect on the variable name and label.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;compute VARNAME;&lt;BR /&gt;&lt;BR /&gt;if dup_label = 'Y' then do;&lt;BR /&gt;call define(_COL_,"style","STYLE={background=#ffa500}");&lt;BR /&gt;end;&lt;BR /&gt;&lt;BR /&gt;endcomp;&lt;BR /&gt;&lt;BR /&gt;compute VARLABEL;&lt;BR /&gt;&lt;BR /&gt;if dup_label = 'Y' then do;&lt;BR /&gt;call define(_COL_,"style","STYLE={background=#ffa500}");&lt;BR /&gt;end;&lt;BR /&gt;&lt;BR /&gt;endcomp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to accomplish this task of shading in orange the variable name and label when dup_label = 'Y'?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance for your assistance.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Mar 2021 19:19:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/COMPUTE-BLOCK-in-PROC-REPORT/m-p/728267#M226597</guid>
      <dc:creator>cgsmoak56</dc:creator>
      <dc:date>2021-03-22T19:19:05Z</dc:date>
    </item>
    <item>
      <title>Re: COMPUTE BLOCK in PROC REPORT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/COMPUTE-BLOCK-in-PROC-REPORT/m-p/728271#M226599</link>
      <description>&lt;P&gt;When asking about Proc Report &lt;STRONG&gt;always&lt;/STRONG&gt; include the entire procedure code. There are things that are dependent on the order of appearance on the&amp;nbsp; Columns statement for instance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Basic rule of thumb: proc report builds the report from right to left. So if you use a compute block for a variable and reference a variable that appears to the right of that column then that part of the code doesn't see the bit to the right.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So this is a guess:&lt;/P&gt;
&lt;PRE&gt;compute dup_label;

if dup_label = 'Y' then do;
   call define(_COL_,"style","STYLE={background=#ffa500}");
   call define('varlabel',"style","STYLE={background=#ffa500}");
end;

endcomp;&lt;/PRE&gt;
&lt;P&gt;You can name a specific variable column to modify as well as the present column or row with _col_ and _row_ locations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Mar 2021 19:27:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/COMPUTE-BLOCK-in-PROC-REPORT/m-p/728271#M226599</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-03-22T19:27:29Z</dc:date>
    </item>
    <item>
      <title>Re: COMPUTE BLOCK in PROC REPORT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/COMPUTE-BLOCK-in-PROC-REPORT/m-p/728476#M226677</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the full code for this section of the program.&amp;nbsp; Please look at the compute block for dup_label which I have bolded below.&amp;nbsp; This code does turn the cells in the dup_label column orange when dup_label = 'Y'.&amp;nbsp; However, it turn all cells for NAME and LABEL orange.&amp;nbsp; I only want them to be orange for the instances where dup_label = 'Y'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ods excel&lt;BR /&gt;options(sheet_name=%cmpres("&amp;amp;odsdata") sheet_interval='TABLE' gridlines='ON' flow='DATA');&lt;/P&gt;&lt;P&gt;proc report data=&amp;amp;odsdata nowd&lt;BR /&gt;style(report)=[bordercolor=black]&lt;BR /&gt;style(lines)=header{background=white asis=on font_size=10pt font_face="Arial" font_weight=bold color=#000000&lt;BR /&gt;just=left bordercolor=black}&lt;BR /&gt;style(header)=header{background=$color. font_size=10pt font_face="Arial" font_weight=bold color=#000000&lt;BR /&gt;frame=box bordercolor=black}&lt;BR /&gt;style(column)=header{background=white font_size=10pt font_face="Arial" font_weight=medium color=#000000&lt;BR /&gt;bordercolor=black};&lt;BR /&gt;&lt;BR /&gt;columns ('_ODS_' NAME LABEL t_vtype t_LENGTH)&lt;BR /&gt;('_Source_' MEMNAME name_std label_new vtype LENGTH)&lt;BR /&gt;('_Instructions_' Mapping_Notes Variable_Use_Flag sdtm_supp dup_name dup_label Label_Length Comments)&lt;BR /&gt;;&lt;BR /&gt;&lt;BR /&gt;define NAME / "Variable Name" flow&lt;BR /&gt;style(column)={cellwidth=1in}&lt;BR /&gt;style(header)={cellwidth=1in background=#8B9985};&lt;BR /&gt;&lt;BR /&gt;define LABEL / "Variable Label" flow&lt;BR /&gt;style(column)={cellwidth=2.5in}&lt;BR /&gt;style(header)={cellwidth=2.5in background=#8B9985};&lt;/P&gt;&lt;P&gt;define t_vtype / "Type" flow&lt;BR /&gt;style(column)={cellwidth=0.6in}&lt;BR /&gt;style(header)={cellwidth=0.8in background=#8B9985};&lt;BR /&gt;&lt;BR /&gt;define t_LENGTH / "Length" flow&lt;BR /&gt;style(column)={cellwidth=0.6in}&lt;BR /&gt;style(header)={cellwidth=0.6in background=#8B9985};&lt;BR /&gt;&lt;BR /&gt;define MEMNAME / "Dataset" flow&lt;BR /&gt;style(column)={cellwidth=1in}&lt;BR /&gt;style(header)={cellwidth=1in background=#ffdab9};&lt;BR /&gt;&lt;BR /&gt;define name_std / "Variable Name" flow&lt;BR /&gt;style(column)={cellwidth=1in}&lt;BR /&gt;style(header)={cellwidth=1in background=#ffdab9};&lt;BR /&gt;&lt;BR /&gt;define label_new / "Variable Label" flow&lt;BR /&gt;style(column)={cellwidth=2.5in}&lt;BR /&gt;style(header)={cellwidth=2.5in background=#ffdab9};&lt;BR /&gt;&lt;BR /&gt;define vtype / "Type" flow&lt;BR /&gt;style(column)={cellwidth=0.6in}&lt;BR /&gt;style(header)={cellwidth=0.8in background=#ffdab9};&lt;BR /&gt;&lt;BR /&gt;define LENGTH / "Length" flow&lt;BR /&gt;style(column)={cellwidth=0.6in}&lt;BR /&gt;style(header)={cellwidth=0.6in background=#ffdab9};&lt;BR /&gt;&lt;BR /&gt;define Mapping_Notes / "Mapping Notes" flow&lt;BR /&gt;style(column)={cellwidth=1in}&lt;BR /&gt;style(header)={cellwidth=1in background=#00FFFF};&lt;BR /&gt;&lt;BR /&gt;define Variable_Use_Flag / "Variable Use Flag" flow&lt;BR /&gt;style(column)={cellwidth=1.25in}&lt;BR /&gt;style(header)={cellwidth=1.25in background=#00FFFF};&lt;BR /&gt;&lt;BR /&gt;define sdtm_supp / "SDTM or Potential Suppqual" flow&lt;BR /&gt;style(column)={cellwidth=2in}&lt;BR /&gt;style(header)={cellwidth=2in background=#00FFFF};&lt;BR /&gt;&lt;BR /&gt;define dup_name / "Duplicate Variable" flow&lt;BR /&gt;style(column)={cellwidth=1.25in}&lt;BR /&gt;style(header)={cellwidth=1.25in background=#00FFFF};&lt;BR /&gt;&lt;BR /&gt;define dup_label / "Duplicate_Label" flow&lt;BR /&gt;style(column)={cellwidth=1.25in}&lt;BR /&gt;style(header)={cellwidth=1.25in background=#00FFFF};&lt;BR /&gt;&lt;BR /&gt;define Label_Length / "Label Length" flow&lt;BR /&gt;style(column)={cellwidth=1.25in}&lt;BR /&gt;style(header)={cellwidth=1.25in background=#00FFFF};&lt;BR /&gt;&lt;BR /&gt;define Comments / "Comments" flow&lt;BR /&gt;style(column)={cellwidth=1.25in}&lt;BR /&gt;style(header)={cellwidth=1.25in background=#00FFFF};&lt;BR /&gt;&lt;BR /&gt;compute NAME;&lt;BR /&gt;&lt;BR /&gt;call define(_COL_,"style","STYLE={background=#ffa500}");&lt;BR /&gt;&lt;BR /&gt;endcomp;&lt;BR /&gt;&lt;BR /&gt;compute LABEL;&lt;BR /&gt;&lt;BR /&gt;call define(_COL_,"style","STYLE={background=#ffa500}");&lt;BR /&gt;&lt;BR /&gt;endcomp;&lt;BR /&gt;&lt;BR /&gt;compute Mapping_Notes;&lt;BR /&gt;&lt;BR /&gt;call define(_COL_,"style","STYLE={background=#FFFF00}");&lt;BR /&gt;&lt;BR /&gt;endcomp;&lt;BR /&gt;&lt;BR /&gt;compute Variable_Use_Flag;&lt;BR /&gt;&lt;BR /&gt;call define(_COL_,"style","STYLE={background=#FFFF00}");&lt;BR /&gt;&lt;BR /&gt;endcomp;&lt;BR /&gt;&lt;BR /&gt;compute dup_name;&lt;BR /&gt;&lt;BR /&gt;if dup_name = 'Y' then do;&lt;BR /&gt;call define(_COL_,"style","STYLE={background=#ffa500}");&lt;BR /&gt;end;&lt;BR /&gt;&lt;BR /&gt;endcomp;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;compute dup_label;&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;if dup_label = 'Y' then do;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;call define(_COL_,"style","STYLE={background=#ffa500}");&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;call define('NAME',"style","STYLE={background=#ffa500}");&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;call define('LABEL',"style","STYLE={background=#ffa500}");&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;end;&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;endcomp;&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;compute Label_Length;&lt;BR /&gt;&lt;BR /&gt;Label_Length=length(LABEL);&lt;BR /&gt;&lt;BR /&gt;if Label_Length &amp;gt; 40 then do;&lt;BR /&gt;call define(_COL_,"style","STYLE={background=#ffa500}");&lt;BR /&gt;end;&lt;BR /&gt;&lt;BR /&gt;endcomp;&lt;BR /&gt;&lt;BR /&gt;compute Comments;&lt;BR /&gt;&lt;BR /&gt;call define(_COL_,"style","STYLE={background=#FFFF00}");&lt;BR /&gt;&lt;BR /&gt;endcomp;&lt;BR /&gt;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Mar 2021 15:47:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/COMPUTE-BLOCK-in-PROC-REPORT/m-p/728476#M226677</guid>
      <dc:creator>cgsmoak56</dc:creator>
      <dc:date>2021-03-23T15:47:37Z</dc:date>
    </item>
    <item>
      <title>Re: COMPUTE BLOCK in PROC REPORT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/COMPUTE-BLOCK-in-PROC-REPORT/m-p/728609#M226704</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; I think I've spotted part of the issue.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cynthia_sas_0-1616545935491.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/56349i883D27A21CEE6B4E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cynthia_sas_0-1616545935491.png" alt="Cynthia_sas_0-1616545935491.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; You should find that NAME and LABEL are set to your chosen color on every row, but only the dup_label=Y rows are being set conditionally. To test this, change the colors in the NAME and LABEL compute blocks to pink or green or some other color than #ffa500 (orange). The conditional highlighting in the compute block for DUP_LABEL will only override the rows where the condition is met. If you don't want these cells highlighted differently you might just delete the compute blocks for NAME and LABEL.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Another comment, FLOW as a DEFINE statement option is ignored by ODS because it is a LISTING only option. the sub-option for flow='DATA' should be OK in ODS EXCEL, but it has nothing to do really with the FLOW option on the DEFINE statement. And I realize that you might not have shown your full code, but the STYLE(LINES) option seems to be unnecessary, since you don't have any LINE statements in your code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Hope this helps,&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 00:39:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/COMPUTE-BLOCK-in-PROC-REPORT/m-p/728609#M226704</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2021-03-24T00:39:34Z</dc:date>
    </item>
    <item>
      <title>Re: COMPUTE BLOCK in PROC REPORT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/COMPUTE-BLOCK-in-PROC-REPORT/m-p/728802#M226761</link>
      <description>&lt;P&gt;Thank you, Cynthia!&amp;nbsp; Your solution worked.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 16:04:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/COMPUTE-BLOCK-in-PROC-REPORT/m-p/728802#M226761</guid>
      <dc:creator>cgsmoak56</dc:creator>
      <dc:date>2021-03-24T16:04:55Z</dc:date>
    </item>
  </channel>
</rss>

