<?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: PROC REPORT Conditional Formatting Issue in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-REPORT-Conditional-Formatting-Issue/m-p/588674#M168277</link>
    <description>&lt;P&gt;Proc Report builds the output from left to right and top to bottom. If a Compute block references a variable that appears to the right in the columns position of that value then it doesn't "see" the values. So they can't be used to format those cells.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;AgeCalcDy appears&amp;nbsp;before AgeRptdUnits&amp;nbsp; in your Columns statement, so that is what doesn't happen. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;Similar with the other problem variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Simplest would be change the order of variables in the Column statement.&lt;/P&gt;
&lt;P&gt;Realizing that one reason you may be doing the report is to match a required layout then one solution is to create a copy of your problem variable in your data set such as AgeDummy, add it to the Columns statement before the columns that will use the values. Then have&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Define AgeDummy / noprint;&lt;/P&gt;
&lt;P&gt;to suppress the values from actually appearing in the report.&lt;/P&gt;
&lt;P&gt;And use AgeDummy in the compute block instead.&lt;/P&gt;</description>
    <pubDate>Fri, 13 Sep 2019 22:29:17 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-09-13T22:29:17Z</dc:date>
    <item>
      <title>PROC REPORT Conditional Formatting Issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-REPORT-Conditional-Formatting-Issue/m-p/588648#M168264</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC REPORT DATA=WORK.A_EXTRACT;
	TITLE1 'LINE LIST OF DATA ENTRY EXCEPTIONS';
	TITLE2 "AS OF %QUPCASE(%LEFT(%QSYSFUNC(DATE(),WORDDATE18.)))";
	WHERE
		Year = 2019 AND
		CntInv = 1 AND
		(
			(
				(AgeCalcDy IS NULL AND AgeCalcMnth IS NULL AND AgeCalcYr IS NULL) OR
				(AgeRptdUnits = 'D' AND (AgeRptd NE AgeCalcDy)) OR
				(AgeRptdUnits = 'M' AND (AgeRptd NE AgeCalcMnth)) OR
				(AgeRptdUnits = 'Y' AND (AgeRptd NE AgeCalcYr)) 
			) OR
			(AgeRptd IS NULL) OR
			(AgeRptdUnits IS NULL) OR
			(DOB IS NULL) 
		)
	;
	COLUMNS
		PersonID
		LocalID
		DiseaseRepCat
		AgeCalcDy
		AgeCalcMnth
		AgeCalcYr
		AgeRptd
		AgeRptdUnits
		DOB
	;
	DEFINE PersonID / ORDER;
	DEFINE LocalID / ORDER;
	DEFINE DiseaseRepCat / ORDER;
	DEFINE AgeCalcDy / DISPLAY;
	DEFINE AgeCalcMnth / DISPLAY;
	DEFINE AgeCalcYr / DISPLAY;
	DEFINE AgeRptd / DISPLAY;
	DEFINE AgeRptdUnits / DISPLAY;
	DEFINE DOB / DISPLAY;
	
	COMPUTE AgeCalcDy;
		IF AgeRptdUnits = 'D' AND (AgeRptd NE AgeCalcDy) THEN
			CALL DEFINE(_COL_,"STYLE","STYLE={BACKGROUNDCOLOR=YELLOW}");
	ENDCOMP;
	COMPUTE AgeCalcMnth;
		IF AgeRptdUnits = 'M' AND (AgeRptd NE AgeCalcMnth) THEN
			CALL DEFINE(_COL_,"STYLE","STYLE={BACKGROUNDCOLOR=YELLOW}");
	ENDCOMP;
	COMPUTE AgeCalcYr;
		IF AgeRptdUnits = 'Y' AND (AgeRptd NE AgeCalcYr) THEN
			CALL DEFINE(_COL_,"STYLE","STYLE={BACKGROUNDCOLOR=YELLOW}");
	ENDCOMP;
	COMPUTE AgeRptd;
		IF AgeRptd=. THEN
			CALL DEFINE(_COL_,"STYLE","STYLE={BACKGROUNDCOLOR=YELLOW}");
	ENDCOMP;
	COMPUTE AgeRptdUnits;
		IF AgeRptdUnits='' THEN
			CALL DEFINE(_COL_,"STYLE","STYLE={BACKGROUNDCOLOR=YELLOW}");
	ENDCOMP;
	COMPUTE DOB;
		IF DOB=. THEN
			CALL DEFINE(_COL_,"STYLE","STYLE={BACKGROUNDCOLOR=YELLOW}");
	ENDCOMP;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;My conditional highlighting works for AgeRptd,&amp;nbsp;AgeRptdUnits, and DOB...the fields with a single condition to meet. What am I doing wrong for&amp;nbsp;AgeCalcDy,&amp;nbsp;AgeCalcMnth, and&amp;nbsp;AgeCalcYr? Is it not possible to require two conditions to be met if you want to conditionally hightlight something?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Sep 2019 19:29:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-REPORT-Conditional-Formatting-Issue/m-p/588648#M168264</guid>
      <dc:creator>gdaymte</dc:creator>
      <dc:date>2019-09-13T19:29:09Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT Conditional Formatting Issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-REPORT-Conditional-Formatting-Issue/m-p/588674#M168277</link>
      <description>&lt;P&gt;Proc Report builds the output from left to right and top to bottom. If a Compute block references a variable that appears to the right in the columns position of that value then it doesn't "see" the values. So they can't be used to format those cells.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;AgeCalcDy appears&amp;nbsp;before AgeRptdUnits&amp;nbsp; in your Columns statement, so that is what doesn't happen. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;Similar with the other problem variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Simplest would be change the order of variables in the Column statement.&lt;/P&gt;
&lt;P&gt;Realizing that one reason you may be doing the report is to match a required layout then one solution is to create a copy of your problem variable in your data set such as AgeDummy, add it to the Columns statement before the columns that will use the values. Then have&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Define AgeDummy / noprint;&lt;/P&gt;
&lt;P&gt;to suppress the values from actually appearing in the report.&lt;/P&gt;
&lt;P&gt;And use AgeDummy in the compute block instead.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Sep 2019 22:29:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-REPORT-Conditional-Formatting-Issue/m-p/588674#M168277</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-09-13T22:29:17Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT Conditional Formatting Issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-REPORT-Conditional-Formatting-Issue/m-p/588679#M168278</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Your problem is the fact that PROC REPORT has a "left to right" rule for what you can reference in a COMPUTE block. The issue is not your compound condition, the issue is as shown in the slightly rearranged code below:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="left_right_rule_redux.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/32458iC549B272DF736EC9/image-size/large?v=v2&amp;amp;px=999" role="button" title="left_right_rule_redux.png" alt="left_right_rule_redux.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To go by the color coding in the rearranged COLUMN statement. In the "green" COMPUTE blocks you are trying to reference the yellow and pink variables. This won't work. PROC REPORT does not have a PDV like the DATA step. PROC REPORT writes one report row at a time, working from left-to-right based on the order of the variables in the COLUMN statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; At the point in time when your AgeCalcDy item is written to the report row, the yellow and pink columns have not been written yet. At this point in time, PROC REPORT only knows what the values are for PersonID LocalID DiseaseRepCat and AgeCalcDy. Then, when AgeCalcMnth is being placed on the report row, the yellow and pink columns still have not been written yet. At that point in time, PROC REPORT only knows what the values are for&amp;nbsp; PersonID LocalID DiseaseRepCat AgeCalcDy and AgeCalcMnth. When PROC REPORT gets to the last column on the row (in this case, DOB), that's when it has visibility of all the other values on the report row.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Here's a good posting from the Communities on the topic &lt;A href="https://communities.sas.com/t5/General-SAS-Programming/PROC-REPORT-compare-col-vs-col/td-p/368228" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/General-SAS-Programming/PROC-REPORT-compare-col-vs-col/td-p/368228&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Hope this helps explain your issue.&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PS if you're going to post code, it's also nice to post some sample data or use one of the SASHELP datasets to illustrate the issue.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Sep 2019 23:32:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-REPORT-Conditional-Formatting-Issue/m-p/588679#M168278</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2019-09-13T23:32:08Z</dc:date>
    </item>
  </channel>
</rss>

