<?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 PROC REPORT: Conditional formatting based on value of ACROSS variable in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-Conditional-formatting-based-on-value-of-ACROSS/m-p/34801#M5021</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;Being able to reference the ACROSS variable values directly is not as simple as it sounds. My earlier example had only 1 item(HEIGHT) under each value for SEX – so in essence, _C2_ is not just the column for Females, it is the column for the MEAN of HEIGHT of FEMALES; and _C3_ is the column for the MEAN of the HEIGHT of MALES.&amp;nbsp; And that’s just if I had 1 item under SEX…what if I had multiple items or a mix of items and statistics under each unique value of the ACROSS item. And, what if I had 2 ACROSS items, like&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 10pt; font-family: 'Courier New';"&gt;Column product year,month,(sales inventory);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; In the program below, I have a PROC REPORT program that uses REGION (from SASHELP.SHOES) as an ACROSS item, and PRODUCT as the GROUP item on the report, I can write a macro in such as way that my macro program can capture the values that will be set. So, for example, if I run my macro the first time, using a WORK version of SASHELP.SHOES with 3 regions, then my macro can tell me this:&lt;/P&gt;&lt;H1&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;----&amp;gt; _c2_ is absolute column for Asia&lt;/SPAN&gt;&lt;/H1&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt;----&amp;gt; style for this region is style={background=cx99FFCC}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt;----&amp;gt; _c3_ is absolute column for Canada&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt;----&amp;gt; style for this region is style={background=cx9999FF}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt;----&amp;gt; _c4_ is absolute column for Pacific&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt;----&amp;gt; style for this region is style={background=cxFF9999}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;But, if I run the macro a second time, on a different dataset that has only 2 regions, then I can have my macro tell me this:&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt;----&amp;gt; _c2_ is absolute column for United States&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt;----&amp;gt; style for this region is style={background=cxFF99FF}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt;----&amp;gt; _c3_ is absolute column for Western Europe&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt;----&amp;gt; style for this region is style={background=cxFF00FF}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt;&amp;nbsp; &lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;So,&amp;nbsp; although my program sets the background for the whole column based on the user-defined format, you could easily also write an IF statement, since the program createsa macro variable that holds the value for each absolute column name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;It is more advanced PROC REPORT coding and if you really need the report to be dynamic, then macro coding is the only way to make that happen. If you know the entire universe of possible values for your ACROSS item(as I do for SASHELP.SHOES), then you can code the PROC FORMAT ahead of time.It is always possible to generate the PROC FORMAT dynamically, too, but I think this example goes far enough to show what is possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cynthia&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;options mprint;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;ods listing close;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;** start macro program definition;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;%MACRO&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt; do_acr(dsn=, oname=, startcol=2, &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; varsunder=1, varsleft=1);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;** get list of distinct regions from input data set;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;** and get count of distinct regions;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;proc sql;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; select distinct region, count(distinct region) &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; into :reglist separated by '~', :num&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; from &amp;amp;dsn;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;quit;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;%put &amp;amp;num &amp;amp;reglist;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;** create macro variables based on region list;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;** and use format to set color;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;** macro variables will hold the actual region value;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;** and the absolute column is calculated automatically.;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;DATA _NULL_;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; length reglist $200 thisreg $25 thisbkg $20 stylestring $100;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; reglist="&amp;amp;reglist";&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; varsleft = &amp;amp;varsleft;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; do i = 1 to &amp;amp;num;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; abscol = i + varsleft;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; thisreg = scan(reglist,i,'~');&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; thisbkg = put(thisreg,$rfmt.);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; stylestring='style={background='||trim(thisbkg)||'}';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call symput('_c'||trim(left(put(abscol,2.)))||'_',trim(thisreg));&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call symput('s'||trim(left(put(abscol,2.))),trim(stylestring));&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; end;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;** write info about absolutecolumn and value to log;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;%DO i=&amp;amp;startcol %TO %EVAL(&amp;amp;num*&amp;amp;varsunder+&amp;amp;varsleft)%BY &amp;amp;varsunder;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; %put ----&amp;gt; &amp;amp;i. is absolute column for&amp;amp;&amp;amp;&amp;amp;_c&amp;amp;i._ ;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; %put ----&amp;gt; style for this region is&amp;amp;&amp;amp;s&amp;amp;i;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;%end;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;** create HTML file and use oname macro variable;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;ods html file="c:\temp\&amp;amp;oname..html"style=sasweb;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; title 'Regions should be different colors based on format';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;proc report data=&amp;amp;dsn&amp;nbsp; nowd;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; column ('Product' product) region,sales;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; define product / group ' ';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; define region / across;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; define sales / mean ' ';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; compute sales;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %DO i=&amp;amp;startcol %TO %EVAL(&amp;amp;num*&amp;amp;varsunder+&amp;amp;varsleft)%BY &amp;amp;varsunder;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call define("_C%eval(&amp;amp;i)_",'style',"&amp;amp;&amp;amp;s&amp;amp;i");&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %END;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; endcomp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;ods html close;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;%mend&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt; do_acr;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;** end macro program definition;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;** create a user-defined format with the colors;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;** desired for all POSSIBLE values of REGION;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;proc&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt; format;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; value $rfmt 'Africa'='cx66ffff'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Asia'='cx99FFCC'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Canada'='cx9999FF'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Central America/Caribbean'='cxCCCC00'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Eastern Europe'='cxCCCCFF'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Middle East'='cxCCFFCC'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Pacific'='cxFF9999'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'South America'='cxFFFF99'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'United States'='cxFF99FF'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Western Europe'='cxFF00FF';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;run&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;** create a data set with 3 values for Region;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;proc&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt; sort data=sashelp.shoes out=sortshoes1;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; by region;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; where region in ('Asia' 'Canada' 'Pacific');&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;run&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;** invoke macro with 3 values for region;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;%&lt;EM&gt;do_acr&lt;/EM&gt;(dsn=sortshoes1, oname=ss1)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;** now create a new data set with 2 values for Region;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;proc&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt; sort data=sashelp.shoes out=sortshoes2;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; by region;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; where region in ('United States' 'Western Europe');&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;run&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;** invoke macro with data that has 2 values and diff colors;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;%&lt;EM&gt;do_acr&lt;/EM&gt;(dsn=sortshoes2, oname=ss2)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;** now create a data set with all vaues for Region;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;proc&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt; sort data=sashelp.shoes out=sortshoes3;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; by region;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;run&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;** invoke macro with data that has all values and diff colors;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;%&lt;EM&gt;do_acr&lt;/EM&gt;(dsn=sortshoes3, oname=ss3)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;title;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;footnote;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;ods listing;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;options nomprint;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 22 Jan 2012 04:05:49 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2012-01-22T04:05:49Z</dc:date>
    <item>
      <title>PROC REPORT: Conditional formatting based on value of ACROSS variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-Conditional-formatting-based-on-value-of-ACROSS/m-p/34796#M5016</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We are trying to create a report using PROC REPORT in which we like to use conditional formatting based on the value of the across variable.&lt;/P&gt;&lt;P&gt;The environment we are working in for this report is SAS 9.1 and EG 4.1&lt;/P&gt;&lt;P&gt;The input dataset we are using has a structure similar to the this test dataset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;data work.testdataset ;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; length varA varB varC $2 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; length varD 8 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input varA varB varC varD ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; datalines ;&lt;/P&gt;&lt;P&gt;x1 y1 0x .&lt;/P&gt;&lt;P&gt;x1 y1 1x 3&lt;/P&gt;&lt;P&gt;x1 y1 2x 6&lt;/P&gt;&lt;P&gt;x1 y2 0x 2&lt;/P&gt;&lt;P&gt;x1 y2 1x 4&lt;/P&gt;&lt;P&gt;x1 y2 2x .&lt;/P&gt;&lt;P&gt;x2 y1 0x .&lt;/P&gt;&lt;P&gt;x2 y1 1x 1&lt;/P&gt;&lt;P&gt;x2 y1 2x 2&lt;/P&gt;&lt;P&gt;x2 y2 0x 4&lt;/P&gt;&lt;P&gt;x2 y2 1x 8&lt;/P&gt;&lt;P&gt;x2 y2 2x .&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run ;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The base code for the report we are creating is as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;title ; footnote ;&lt;P&gt;proc report data=work.testdataset nowindows ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; columns varA (varB,(varC,varD)) ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; define varA / group ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; define varB / across nozero ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; define varC / across nozero ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; define varD / analysis sum ;&lt;/P&gt;&lt;P&gt;run ;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With the output set to HTML this produces a report as shown in the attachment (PROC_REPORT_ACROSS_VARS.PNG).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Our wish is to use conditional formatting based on the content of varB. &lt;/P&gt;&lt;P&gt;In case the value of varB is y1 then the format of the column should be for example 8.2.&lt;/P&gt;&lt;P&gt;In case the value of varB is y2 then the format of the column should become 8.3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have read the suggestion made in the thread &lt;A _jive_internal="true" href="https://communities.sas.com/thread/14364"&gt;PROC REPORT: Conditional formatting of columns of across variable&lt;/A&gt; but the solution as mentioned in the paper is conditional formatting based on the content of the cells (so basically the value of varD).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hopefully there is a more elegant solution than:&lt;/P&gt;&lt;PRE&gt;call define ('_cx_','format','8.x')&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since this would have to be edited each time new values of varC occur.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help or hints are appreciated.&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/10606i0ABFA264EA279BDA/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="PROC_REPORT_ACROSS_VARS.PNG" title="PROC_REPORT_ACROSS_VARS.PNG" /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jan 2012 20:45:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-Conditional-formatting-based-on-value-of-ACROSS/m-p/34796#M5016</guid>
      <dc:creator>Resa</dc:creator>
      <dc:date>2012-01-20T20:45:55Z</dc:date>
    </item>
    <item>
      <title>PROC REPORT: Conditional formatting based on value of ACROSS variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-Conditional-formatting-based-on-value-of-ACROSS/m-p/34797#M5017</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; The _Cx_ syntax is elegant, when combined with macro processing. Before you run your PROC REPORT, you can run a macro to find the unique values of VARC -- then the macro program can be coded to generate the CALL DEFINE statements that you need. Yes, it is indirect...but it is how you deal with the absolute column numbers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; This paper &lt;A href="http://support.sas.com/rnd/papers/sgf07/sgf2007-report.pdf"&gt;http://support.sas.com/rnd/papers/sgf07/sgf2007-report.pdf&lt;/A&gt;&amp;nbsp; shows an example of a macro program which does that kind of processing. The relevant pages are 12-14, but the whole paper is worthwhile. The example in the paper uses some other condition to do the formatting. In your case, if you had something like this program, which is based on SASHELP.CLASS, I know that F values will occur first and M values will occur second. So I don't need to use a condition to set the color, I just make _C2_ (Females) have a background of pink and I make _C3_ a background of cyan.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; If you use the OUT= option, you can tell what absolute column names have been created. If you use the macro example or something like it, then you just need to have some idea of what all the possible values could be and what colors you would want to assign. You can code the colors in the macro program or use other techniques to set the colors.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;ods&lt;/SPAN&gt; &lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;html&lt;/SPAN&gt; &lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;file&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: purple; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;'c:\temp\color_gender.html' &lt;/SPAN&gt;&lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;style&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;=sasweb;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="color: navy; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;proc &lt;/SPAN&gt;&lt;SPAN style="color: navy; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;report &lt;/SPAN&gt;&lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;=sashelp.class &lt;/SPAN&gt;&lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;nowd&lt;/SPAN&gt; &lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;out&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;=whatcols;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;column &lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;age sex,height;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;define &lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;age / &lt;/SPAN&gt;&lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;group&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;define &lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;sex / &lt;/SPAN&gt;&lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;across&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;define &lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;height / &lt;/SPAN&gt;&lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;mean&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;compute &lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;sex;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;call &lt;/SPAN&gt;&lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;define&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: purple; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;'_c2_'&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: purple; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;'style'&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: purple; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;'style={background=pink}'&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;);&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;call&lt;/SPAN&gt; &lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;define&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: purple; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;'_c3_'&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: purple; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;'style'&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: purple; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;'style={background=cyan}'&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;);&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;endcomp&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="color: navy; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;run&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="color: navy; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;proc &lt;/SPAN&gt;&lt;SPAN style="color: navy; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;print &lt;/SPAN&gt;&lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;=whatcols;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="color: navy; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;run&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;ods&lt;/SPAN&gt; &lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;html&lt;/SPAN&gt; &lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;close&lt;/SPAN&gt;;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jan 2012 23:45:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-Conditional-formatting-based-on-value-of-ACROSS/m-p/34797#M5017</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2012-01-20T23:45:56Z</dc:date>
    </item>
    <item>
      <title>PROC REPORT: Conditional formatting based on value of ACROSS variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-Conditional-formatting-based-on-value-of-ACROSS/m-p/34798#M5018</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Cynthia,&lt;/P&gt;&lt;P&gt;Thanks for your reply. I have read the paper you mention since you also made a reference to this paper in the thread that I mention in my initial question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The call define solution as you suggest when indeed you know or can deduct the columns that are to be set. In your example it is unlikely that another gender will occur besides the M and the F.&lt;/P&gt;&lt;P&gt;In our case the values of varC may vary and in that case the columns of which the formats are to be set will differ.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From your reply I understand that the only possibility is to use a macro &lt;SPAN style="text-decoration: underline;"&gt;&lt;EM&gt;before&lt;/EM&gt;&lt;/SPAN&gt; the PROC REPORT in order to determine the values for x in order to dynamically set the formats for the _cx_ column. But that there is no way to dynamically set the formats inside PROC REPORT since after the pre processing it is impossible to reference the original values of varB.&lt;/P&gt;&lt;P&gt;--Resa&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Jan 2012 13:12:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-Conditional-formatting-based-on-value-of-ACROSS/m-p/34798#M5018</guid>
      <dc:creator>Resa</dc:creator>
      <dc:date>2012-01-21T13:12:19Z</dc:date>
    </item>
    <item>
      <title>PROC REPORT: Conditional formatting based on value of ACROSS variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-Conditional-formatting-based-on-value-of-ACROSS/m-p/34799#M5019</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;In your last sentence did you mean the original values of varB or varC??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you run your macro you can capture the varC values that will become _Cn_ absolute column numbers. So if i needed to know what _C2_ was (in my example, f&lt;/P&gt;&lt;P&gt; Or m ) i could capture it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cynthia&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Jan 2012 16:24:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-Conditional-formatting-based-on-value-of-ACROSS/m-p/34799#M5019</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2012-01-21T16:24:40Z</dc:date>
    </item>
    <item>
      <title>PROC REPORT: Conditional formatting based on value of ACROSS variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-Conditional-formatting-based-on-value-of-ACROSS/m-p/34800#M5020</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Using _Cx_ is a solution that requires a lot of code and SAS expertise, which feels like a last resort to me.&lt;/P&gt;&lt;P&gt;More elegant would be to obtain/reference the across variable values within proc report itself.&lt;/P&gt;&lt;P&gt;Is that at all possible?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Bart&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Jan 2012 17:40:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-Conditional-formatting-based-on-value-of-ACROSS/m-p/34800#M5020</guid>
      <dc:creator>bheinsius</dc:creator>
      <dc:date>2012-01-21T17:40:36Z</dc:date>
    </item>
    <item>
      <title>PROC REPORT: Conditional formatting based on value of ACROSS variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-Conditional-formatting-based-on-value-of-ACROSS/m-p/34801#M5021</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;Being able to reference the ACROSS variable values directly is not as simple as it sounds. My earlier example had only 1 item(HEIGHT) under each value for SEX – so in essence, _C2_ is not just the column for Females, it is the column for the MEAN of HEIGHT of FEMALES; and _C3_ is the column for the MEAN of the HEIGHT of MALES.&amp;nbsp; And that’s just if I had 1 item under SEX…what if I had multiple items or a mix of items and statistics under each unique value of the ACROSS item. And, what if I had 2 ACROSS items, like&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 10pt; font-family: 'Courier New';"&gt;Column product year,month,(sales inventory);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; In the program below, I have a PROC REPORT program that uses REGION (from SASHELP.SHOES) as an ACROSS item, and PRODUCT as the GROUP item on the report, I can write a macro in such as way that my macro program can capture the values that will be set. So, for example, if I run my macro the first time, using a WORK version of SASHELP.SHOES with 3 regions, then my macro can tell me this:&lt;/P&gt;&lt;H1&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;----&amp;gt; _c2_ is absolute column for Asia&lt;/SPAN&gt;&lt;/H1&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt;----&amp;gt; style for this region is style={background=cx99FFCC}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt;----&amp;gt; _c3_ is absolute column for Canada&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt;----&amp;gt; style for this region is style={background=cx9999FF}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt;----&amp;gt; _c4_ is absolute column for Pacific&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt;----&amp;gt; style for this region is style={background=cxFF9999}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;But, if I run the macro a second time, on a different dataset that has only 2 regions, then I can have my macro tell me this:&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt;----&amp;gt; _c2_ is absolute column for United States&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt;----&amp;gt; style for this region is style={background=cxFF99FF}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt;----&amp;gt; _c3_ is absolute column for Western Europe&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt;----&amp;gt; style for this region is style={background=cxFF00FF}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt;&amp;nbsp; &lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;So,&amp;nbsp; although my program sets the background for the whole column based on the user-defined format, you could easily also write an IF statement, since the program createsa macro variable that holds the value for each absolute column name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;It is more advanced PROC REPORT coding and if you really need the report to be dynamic, then macro coding is the only way to make that happen. If you know the entire universe of possible values for your ACROSS item(as I do for SASHELP.SHOES), then you can code the PROC FORMAT ahead of time.It is always possible to generate the PROC FORMAT dynamically, too, but I think this example goes far enough to show what is possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cynthia&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;options mprint;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;ods listing close;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;** start macro program definition;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;%MACRO&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt; do_acr(dsn=, oname=, startcol=2, &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; varsunder=1, varsleft=1);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;** get list of distinct regions from input data set;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;** and get count of distinct regions;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;proc sql;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; select distinct region, count(distinct region) &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; into :reglist separated by '~', :num&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; from &amp;amp;dsn;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;quit;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;%put &amp;amp;num &amp;amp;reglist;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;** create macro variables based on region list;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;** and use format to set color;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;** macro variables will hold the actual region value;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;** and the absolute column is calculated automatically.;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;DATA _NULL_;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; length reglist $200 thisreg $25 thisbkg $20 stylestring $100;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; reglist="&amp;amp;reglist";&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; varsleft = &amp;amp;varsleft;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; do i = 1 to &amp;amp;num;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; abscol = i + varsleft;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; thisreg = scan(reglist,i,'~');&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; thisbkg = put(thisreg,$rfmt.);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; stylestring='style={background='||trim(thisbkg)||'}';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call symput('_c'||trim(left(put(abscol,2.)))||'_',trim(thisreg));&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call symput('s'||trim(left(put(abscol,2.))),trim(stylestring));&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; end;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;** write info about absolutecolumn and value to log;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;%DO i=&amp;amp;startcol %TO %EVAL(&amp;amp;num*&amp;amp;varsunder+&amp;amp;varsleft)%BY &amp;amp;varsunder;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; %put ----&amp;gt; &amp;amp;i. is absolute column for&amp;amp;&amp;amp;&amp;amp;_c&amp;amp;i._ ;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; %put ----&amp;gt; style for this region is&amp;amp;&amp;amp;s&amp;amp;i;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;%end;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;** create HTML file and use oname macro variable;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;ods html file="c:\temp\&amp;amp;oname..html"style=sasweb;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; title 'Regions should be different colors based on format';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;proc report data=&amp;amp;dsn&amp;nbsp; nowd;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; column ('Product' product) region,sales;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; define product / group ' ';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; define region / across;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; define sales / mean ' ';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; compute sales;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %DO i=&amp;amp;startcol %TO %EVAL(&amp;amp;num*&amp;amp;varsunder+&amp;amp;varsleft)%BY &amp;amp;varsunder;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call define("_C%eval(&amp;amp;i)_",'style',"&amp;amp;&amp;amp;s&amp;amp;i");&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %END;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; endcomp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;ods html close;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;%mend&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt; do_acr;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;** end macro program definition;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;** create a user-defined format with the colors;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;** desired for all POSSIBLE values of REGION;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;proc&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt; format;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; value $rfmt 'Africa'='cx66ffff'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Asia'='cx99FFCC'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Canada'='cx9999FF'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Central America/Caribbean'='cxCCCC00'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Eastern Europe'='cxCCCCFF'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Middle East'='cxCCFFCC'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Pacific'='cxFF9999'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'South America'='cxFFFF99'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'United States'='cxFF99FF'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Western Europe'='cxFF00FF';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;run&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;** create a data set with 3 values for Region;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;proc&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt; sort data=sashelp.shoes out=sortshoes1;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; by region;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; where region in ('Asia' 'Canada' 'Pacific');&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;run&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;** invoke macro with 3 values for region;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;%&lt;EM&gt;do_acr&lt;/EM&gt;(dsn=sortshoes1, oname=ss1)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;** now create a new data set with 2 values for Region;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;proc&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt; sort data=sashelp.shoes out=sortshoes2;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; by region;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; where region in ('United States' 'Western Europe');&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;run&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;** invoke macro with data that has 2 values and diff colors;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;%&lt;EM&gt;do_acr&lt;/EM&gt;(dsn=sortshoes2, oname=ss2)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;** now create a data set with all vaues for Region;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;proc&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt; sort data=sashelp.shoes out=sortshoes3;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp; by region;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;run&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;** invoke macro with data that has all values and diff colors;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;%&lt;EM&gt;do_acr&lt;/EM&gt;(dsn=sortshoes3, oname=ss3)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;title;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;footnote;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;ods listing;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;options nomprint;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 22 Jan 2012 04:05:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-Conditional-formatting-based-on-value-of-ACROSS/m-p/34801#M5021</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2012-01-22T04:05:49Z</dc:date>
    </item>
    <item>
      <title>PROC REPORT: Conditional formatting based on value of ACROSS variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-Conditional-formatting-based-on-value-of-ACROSS/m-p/34802#M5022</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Cynthia,&lt;/P&gt;&lt;P&gt;Thanks for providing the example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As Bart indicated earlier it would have been, IMHO, if it would have been possible to reference the across variable within the PROC REPORT.&lt;/P&gt;&lt;P&gt;I'll mark this thread as nevertheless as answered since a more elegant solution than a macro is not possible.&lt;/P&gt;&lt;P&gt;--Resa&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jan 2012 10:36:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-Conditional-formatting-based-on-value-of-ACROSS/m-p/34802#M5022</guid>
      <dc:creator>Resa</dc:creator>
      <dc:date>2012-01-24T10:36:37Z</dc:date>
    </item>
    <item>
      <title>PROC REPORT: Conditional formatting based on value of ACROSS variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-Conditional-formatting-based-on-value-of-ACROSS/m-p/34803#M5023</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Cytnhia,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;&lt;P&gt;Cynthia@sas wrote:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;Being able to reference the ACROSS variable values directly is not as simple as it sounds.&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From a functional (user) point of view I see no problem coding the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;STRONG&gt;&lt;SPAN style="background-color: white; font-size: 10pt; color: navy; font-family: 'Courier New';"&gt;proc &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; color: navy; font-family: 'Courier New';"&gt;report &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;data&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; color: black; font-family: 'Courier New';"&gt;=sashelp.class &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;nowd&lt;/SPAN&gt; &lt;SPAN style="background-color: white; font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;out&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; color: black; font-family: 'Courier New';"&gt;=whatcols;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;STRONG&gt;&amp;nbsp; &lt;SPAN style="background-color: white; font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;column &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; color: black; font-family: 'Courier New';"&gt;age sex,height;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;STRONG&gt;&amp;nbsp; &lt;SPAN style="background-color: white; font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;define &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; color: black; font-family: 'Courier New';"&gt;age / &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;group&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;STRONG&gt;&amp;nbsp; &lt;SPAN style="background-color: white; font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;define &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; color: black; font-family: 'Courier New';"&gt;sex / &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;across&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;STRONG&gt;&amp;nbsp; &lt;SPAN style="background-color: white; font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;define &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; color: black; font-family: 'Courier New';"&gt;height / &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;mean&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;STRONG&gt;&amp;nbsp; &lt;SPAN style="background-color: white; font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;compute &lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;height&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (sex = 'F') then&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;STRONG&gt;&lt;SPAN style="background-color: white; font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;define&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; color: black; font-family: 'Courier New';"&gt;(_col_&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; color: black; font-family: 'Courier New';"&gt;,&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; color: purple; font-family: 'Courier New';"&gt;'style'&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; color: black; font-family: 'Courier New';"&gt;,&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; color: purple; font-family: 'Courier New';"&gt;'style={background=pink}'&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; color: black; font-family: 'Courier New';"&gt;);&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;STRONG&gt;&lt;SPAN style="background-color: white; font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;call&lt;/SPAN&gt; &lt;SPAN style="background-color: white; font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;define&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; color: black; font-family: 'Courier New';"&gt;(_col_&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; color: black; font-family: 'Courier New';"&gt;,&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; color: purple; font-family: 'Courier New';"&gt;'style'&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; color: black; font-family: 'Courier New';"&gt;,&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; color: purple; font-family: 'Courier New';"&gt;'style={background=cyan}'&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; color: black; font-family: 'Courier New';"&gt;);&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;STRONG&gt;&amp;nbsp; &lt;SPAN style="background-color: white; font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;endcomp&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;STRONG&gt;&lt;SPAN style="background-color: white; font-size: 10pt; color: navy; font-family: 'Courier New';"&gt;run&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That this does not work because proc report does not set the across column variable values in a compute block, is something else.&lt;/P&gt;&lt;P&gt;I believe this would be a valuable enhancement to proc report making it much easier to use in many cases.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Bart&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jan 2012 12:18:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-Conditional-formatting-based-on-value-of-ACROSS/m-p/34803#M5023</guid>
      <dc:creator>bheinsius</dc:creator>
      <dc:date>2012-01-25T12:18:09Z</dc:date>
    </item>
    <item>
      <title>PROC REPORT: Conditional formatting based on value of ACROSS variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-Conditional-formatting-based-on-value-of-ACROSS/m-p/34804#M5024</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Hi:&lt;/P&gt;&lt;P&gt;&amp;nbsp; You can always make a suggestion to add that capability via the SASware ballot process.&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/community/ballot/"&gt;http://support.sas.com/community/ballot/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jan 2012 20:02:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-Conditional-formatting-based-on-value-of-ACROSS/m-p/34804#M5024</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2012-01-26T20:02:46Z</dc:date>
    </item>
    <item>
      <title>PROC REPORT: Conditional formatting based on value of ACROSS variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-Conditional-formatting-based-on-value-of-ACROSS/m-p/34805#M5025</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How about SAS itself finding that a useful feature and adding it to the product?&lt;/P&gt;&lt;P&gt; I sometimes (often) miss SAS' drive for enhancing existing products.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 Jan 2012 22:16:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-Conditional-formatting-based-on-value-of-ACROSS/m-p/34805#M5025</guid>
      <dc:creator>bheinsius</dc:creator>
      <dc:date>2012-01-28T22:16:18Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT: Conditional formatting based on value of ACROSS variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-Conditional-formatting-based-on-value-of-ACROSS/m-p/350139#M18334</link>
      <description>&lt;P&gt;Hello-have we seen any progress for this request from 5 years ago?&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2017 18:41:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-Conditional-formatting-based-on-value-of-ACROSS/m-p/350139#M18334</guid>
      <dc:creator>JW_Hyde</dc:creator>
      <dc:date>2017-04-14T18:41:10Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT: Conditional formatting based on value of ACROSS variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-Conditional-formatting-based-on-value-of-ACROSS/m-p/350191#M18335</link>
      <description>Hi:&lt;BR /&gt;  I do not believe the item was ever added as a SASWare ballot item for voting. You might want to check with Tech Support. As far as I know, the original discussion about how to use a Macro program to determine the ACROSS variable values is still a relevant discussion.&lt;BR /&gt; &lt;BR /&gt;cynthia</description>
      <pubDate>Fri, 14 Apr 2017 20:46:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-Conditional-formatting-based-on-value-of-ACROSS/m-p/350191#M18335</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2017-04-14T20:46:58Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT: Conditional formatting based on value of ACROSS variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-Conditional-formatting-based-on-value-of-ACROSS/m-p/350192#M18336</link>
      <description>Thank you Cynthia. I will look to add it to the Ballot. I am just looking for an option similar to the Excel Conditional Formatting colors.&lt;BR /&gt;</description>
      <pubDate>Fri, 14 Apr 2017 20:50:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-Conditional-formatting-based-on-value-of-ACROSS/m-p/350192#M18336</guid>
      <dc:creator>JW_Hyde</dc:creator>
      <dc:date>2017-04-14T20:50:01Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT: Conditional formatting based on value of ACROSS variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-Conditional-formatting-based-on-value-of-ACROSS/m-p/350205#M18337</link>
      <description>&lt;P&gt;Hi:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; I am not sure of what it is you want. SAS does NOT have anything like this Excel popup window for conditional highlighting:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/8331iB7F7C284FD4C5D20/image-size/original?v=1.0&amp;amp;px=-1" alt="example_excel_popup_window.png" title="example_excel_popup_window.png" border="0" /&gt;&lt;/P&gt;
&lt;P&gt;...nor is it likely to add that feature to PROC REPORT since the conditional highlighting you do in REPORT, PRINT or TABULATE must be performed in code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(also added that SAS Web Report Studio, part of the SAS BI Platform does have popup GUI windows to do trafficlighting or conditional highlighting.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; This posting was about how to identify the ACROSS columns, which seems to me to be different than this popup window in Excel.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Highlighting or Traffic lighting is currently possible with PROC PRINT, PROC REPORT and PROC TABULATE using user defined formats and there is an additional method in PROC REPORT using a COMPUTE block and the CALL DEFINE statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Please see this paper &lt;A href="http://support.sas.com/resources/papers/proceedings13/366-2013.pdf" target="_blank"&gt;http://support.sas.com/resources/papers/proceedings13/366-2013.pdf&lt;/A&gt; on pages 9/10 for how to do highlighting with code in PROC PRINT and then on pages 12/13 for PROC REPORT. Examples of highlighting with TABULATE are shown on pages 19/20, but not using user defined formats.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Here's a TABULATE example with PROC FORMAT for the highlighting:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
value agef 11, 12, 13 = 'cxcccccc'
           14, 15, 16 = 'verylightblue';

value wtfmt 0-74 = 'lightblue'
            75-85 = 'lightyellow'
            86-99 = 'lightgreen'
			100-high = 'lightred'
            . = 'pink';
run;

ods html file='c:\temp\forum_tab_highlight.html';
 proc tabulate data=sashelp.class f=7.2;
 title 'Proc Tabulate with highlighting';
 var height weight ;
 class age sex;
 classlev age /style={background=agef.};
 table age=' '  all='Total',
       mean=' '*sex='Gender Avg'*(height weight*{s={background=wtfmt.}})
       mean='Overall Avg'*(height weight*{s={background=wtfmt.}}) /
       style_precedence=row box={label='Age' s={vjust=b}};
 run;
ods _all_ close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;What procedure are you using and what ODS destination are you interested in. The paper only shows HTML output, but trafficlighting or highlighting is supported by any destination that supports style overrides. There are other methods of performing traffic lighting as well, but some of them (changing the table template or designing a custom table template) are really outside the scope of what was covered in the paper.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;cynthia&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2017 22:37:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-Conditional-formatting-based-on-value-of-ACROSS/m-p/350205#M18337</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2017-04-14T22:37:52Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT: Conditional formatting based on value of ACROSS variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-Conditional-formatting-based-on-value-of-ACROSS/m-p/350246#M18339</link>
      <description>Thanks Cynthia. This paper points me in the right direction.&lt;BR /&gt;</description>
      <pubDate>Sat, 15 Apr 2017 11:24:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-Conditional-formatting-based-on-value-of-ACROSS/m-p/350246#M18339</guid>
      <dc:creator>JW_Hyde</dc:creator>
      <dc:date>2017-04-15T11:24:01Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT: Conditional formatting based on value of ACROSS variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-Conditional-formatting-based-on-value-of-ACROSS/m-p/878225#M26299</link>
      <description>&lt;P&gt;Hello:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any way to reference a cell to the right or to the left of the present value? I'm trying to compare the value of a cell with the value of the cell to the left of it, but I haven't been able to make it work in an elegant way. I have the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;	proc report data= ControlDiario showall out=columnas;&lt;BR /&gt;		where Central = "&amp;amp;PowerPlant";&lt;BR /&gt;		columns ('VLE' '' 'Superaciones' Dia) Grupo, ModoFuncionamiento, Medida, VLE, &lt;BR /&gt;			Superaciones, (VLEComparacion Valor);&lt;BR /&gt;		define Dia / group order=internal &lt;BR /&gt;			style(column)={width=160 tagattr='type:DateTime format:DD/MM/YYYY'};&lt;BR /&gt;		define Grupo / across '' format=&amp;amp;FormatoGrupos preloadfmt order=data;&lt;BR /&gt;		define ModoFuncionamiento / across nozero '';&lt;BR /&gt;		define Medida / across '' format=$FormatoMedida. preloadfmt order=data;&lt;BR /&gt;		define Superaciones / across '';&lt;BR /&gt;		define VLE / across '';&lt;BR /&gt;		define VLEComparacion / noprint;&lt;BR /&gt;		compute Valor;&lt;BR /&gt;			call symputx('ColValor', cats('_c', _col_, '_'));&lt;BR /&gt;			call symputx('ColVLE', cats('_c', _col_ - 1, '_'));&lt;BR /&gt;			if symget('ColValor') &amp;gt; symget('ColVLE') then do;&lt;BR /&gt;				call define(_col_, 'style', 'style=[background=very_light_vivid_red]');&lt;BR /&gt;			end;&lt;BR /&gt;		endcomp;&lt;/PRE&gt;&lt;P&gt;I thought ColValor would get the number of the present column (_col_) and I could compare it with the column to its left (ColVLE with value _col_ - 1), but the macro variables are not getting the right values.&lt;/P&gt;&lt;P&gt;On the other side, this is working, but I have to create a big array every time:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;	proc report data = ControlMensual;
		columns ("VLE" '' 'Superaciones' Mes) Grupo, ModoFuncionamiento, Medida, 
			VLE, Superaciones, (VLEComparacion Valor);
		define Mes / group format=FormatoMeses. preloadfmt order=data;
		define Grupo / across '' format=&amp;amp;FormatoGrupos preloadfmt order=data;
		define ModoFuncionamiento / across nozero '';
		define Medida / across '' format=$FormatoMedida. preloadfmt order=data;
		define Superaciones / across '';
		define VLE / across '';
		define VLEComparacion / noprint;
		compute Valor;
			array Columnas(2000) 
			%do i = 1 %to 2000; _c&amp;amp;i._ %end;;
			if Columnas(_col_) &amp;gt; Columnas(_col_ - 1) then 
				call define(_col_, 'style', 'style=[background=very_light_vivid_red]');
		endcomp;
	run;&lt;/PRE&gt;&lt;P&gt;Do you know any way to resolve the name of the macros in the first code so that I can compare the present column with another one to the left of it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks and regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jordi&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 May 2023 13:29:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-Conditional-formatting-based-on-value-of-ACROSS/m-p/878225#M26299</guid>
      <dc:creator>JordiGC</dc:creator>
      <dc:date>2023-05-30T13:29:26Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT: Conditional formatting based on value of ACROSS variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-Conditional-formatting-based-on-value-of-ACROSS/m-p/878337#M26301</link>
      <description>&lt;P&gt;Hi: You have added a new post to a Forum thread that started in 2012 and was modified in 2017. The answer is still the same as originally posted. I do not think you can use CALL SYMPUTX and then SYMGET in the same COMPUTE block, but that would be a question for SAS Tech Support. Your second attempt with an ARRAY statement and a %DO loop doesn't make sense to me. I would expect that you're getting some kind of error in the COMPUTE block, something like:&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&lt;STRONG&gt;ERROR: The %DO statement is not valid in open code.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&lt;STRONG&gt;WARNING: Apparent symbolic reference I not resolved.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&lt;STRONG&gt;ERROR: The %END statement is not valid in open code.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;Because the %DO loop belongs in a SAS macro program. And the other issue I see is that you have at least 5 nestings of ACROSS items with 2 variables under each nesting. Then you make one of the variables NOPRINT -- but even as a NOPRINT item, your VLEComparacion variable will be assigned an absolute column number and so will the Valor variable. Even when you make a variable NOPRINT, it will get an absolute column number. So I think your second attempt will not work either. You might want to work with SAS Tech Support so you can show them ALL your data (or a subset) and ALL your formats and ALL your code and work with them on the best suggestion for how to do what you want to do. Also, I would suggest starting a new post in the forum. While your example does use ACROSS variables, your usage is so different from the original 2012 posting, that it really deserves to be a new post. &lt;BR /&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2023 16:03:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-Conditional-formatting-based-on-value-of-ACROSS/m-p/878337#M26301</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2023-05-31T16:03:44Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT: Conditional formatting based on value of ACROSS variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-Conditional-formatting-based-on-value-of-ACROSS/m-p/878476#M26302</link>
      <description>&lt;P&gt;Three suggestions:&lt;/P&gt;
&lt;P&gt;1) Start your own thread. If you want to reference this thread you can copy the URL from your browser and paste into the text of your problem description. One thing as author of a thread you can select a response as a solution, assuming one is provided.&lt;/P&gt;
&lt;P&gt;2) Provide a small data set in the form of data step OR reference one of the SAS supplied data sets in the SASHELP library that provides enough variables to do something similar to what you want.&lt;/P&gt;
&lt;P&gt;3) With that example data set provide a table, such as manually made in a word processor, showing the behaviors you want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Very complex comparisons might be better done before Proc Report (or other report procedure) hence the requests for data and desired appearance.&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2023 15:51:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-Conditional-formatting-based-on-value-of-ACROSS/m-p/878476#M26302</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-05-31T15:51:19Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT: Conditional formatting based on value of ACROSS variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-Conditional-formatting-based-on-value-of-ACROSS/m-p/878622#M26303</link>
      <description>Thanks you for your answer, even if the thread has some years now.&lt;BR /&gt;About the second solution, it actually works :). I just need to make it more efficient.</description>
      <pubDate>Thu, 01 Jun 2023 07:50:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-Conditional-formatting-based-on-value-of-ACROSS/m-p/878622#M26303</guid>
      <dc:creator>JordiGC</dc:creator>
      <dc:date>2023-06-01T07:50:41Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT: Conditional formatting based on value of ACROSS variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-Conditional-formatting-based-on-value-of-ACROSS/m-p/878623#M26304</link>
      <description>Thanks for your suggestions ballardw. I will do so next time. There is no need to open a new thread for this topic now.</description>
      <pubDate>Thu, 01 Jun 2023 07:51:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-Conditional-formatting-based-on-value-of-ACROSS/m-p/878623#M26304</guid>
      <dc:creator>JordiGC</dc:creator>
      <dc:date>2023-06-01T07:51:35Z</dc:date>
    </item>
  </channel>
</rss>

