<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Problem Traffic Lighting with Proc Report in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Problem-Traffic-Lighting-with-Proc-Report/m-p/150008#M11575</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much Cynthia! The report works and looks great, I really appreciate your quick and detailed response! (The parts of the code that were misspelled/ wrong parenthesis were due to my having to type out the code by hand (SAS is on a different computer without internet). Thanks again!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 06 Aug 2014 12:09:59 GMT</pubDate>
    <dc:creator>saiaca</dc:creator>
    <dc:date>2014-08-06T12:09:59Z</dc:date>
    <item>
      <title>Problem Traffic Lighting with Proc Report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Problem-Traffic-Lighting-with-Proc-Report/m-p/150006#M11573</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying to create a set of reports that needs to be color coded (background) based on a range of values that I have already grouped. I have successfully colored the rows the correct colors based on the values but I really need to highlight only two of the columns, not all of them. I have tried many different ways to color indiviudal columns, but it only worked with all rows. Here is my code for one of the reports (that works to color the rows):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc report data= comp nowd spansrows style= {background= white foreground=black };&lt;/P&gt;&lt;P&gt;column title unit class count month percent;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; define title/ order=data ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; define unit/ order=data ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; define class/ order=data ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; define count/ order=data ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; define month/ order=data ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; define percent/ order=internal ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* hidden column containing color flag*/&lt;/P&gt;&lt;P&gt;column category;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* dummy column for traffic lighting*/&lt;/P&gt;&lt;P&gt;column dummy;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; define category/ display noprint;&lt;/P&gt;&lt;P&gt;/* traffic light the data columns based on category*/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; define dummy/ computed noprint;&lt;/P&gt;&lt;P&gt;compute dummy;&lt;/P&gt;&lt;P&gt;if category in (1,2,3,4) then call define (_row_), 'style', 'style= {background=' || put (category, colorflag.)']');&lt;/P&gt;&lt;P&gt;endcomp;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The category variable is 1-4 based off of the percent values.&lt;/P&gt;&lt;P&gt;and the format 'colorflag.' is (1=red, 2=orange, 3= yellow, 4=green).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As previously stated, this code works for coloring all rows but I only want title and percent to be colored based off of the category. Changing "_row_" has been unsuccessful, so if anyone has any ideas, I'd really appreciate it!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Chelsea&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Aug 2014 16:20:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Problem-Traffic-Lighting-with-Proc-Report/m-p/150006#M11573</guid>
      <dc:creator>saiaca</dc:creator>
      <dc:date>2014-08-05T16:20:15Z</dc:date>
    </item>
    <item>
      <title>Re: Problem Traffic Lighting with Proc Report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Problem-Traffic-Lighting-with-Proc-Report/m-p/150007#M11574</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; Please carefully review your CALL DEFINE syntax. The parentheses that you show in your code above are incorrect. You should be getting errors in the log. The SPANROWS option is misspelled as SPAN&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;S&lt;/STRONG&gt;&lt;/SPAN&gt;ROWS, which would generate an error. But the CALL DEFINE problem is a bigger problem. I like to avoid making my string in the CALL DEFINE statement by using a TEMP variable as shown in the code below. Instead of using _ROW_, I used the numeric variables COUNT and MONTH and the CHARACTER variable CLASS. Note how the reference for the column names is different depending on the USAGE specified (or not specified) in the DEFINE statement. Since it was not clear what your types were, I just made some fake data from SASHELP.CLASS. I picked different colors, too. I thought they were easier on the eyes.&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;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;data comp (keep=title unit class count month category);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt; set sashelp.class;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt; title=name;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt; unit=age;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt; class=sex;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt; count=height;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt; month=weight;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt; if age in (11,12) then category=1;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt; else if age in (13,14) then category=2;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt; else if age in (15) then category=3;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt; else category=4;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;run;&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;proc format;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; value colorflag 1='lightblue'&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2='lightyellow'&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3='lightgreen'&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4='pink';&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;run;&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;** It is better to only have 1 column statement so I took out the multiple column statements;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;title; footnote;&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ods html file='c:\temp\colorcode.html';&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;proc report data= comp nowd spanrows style= {background= white foreground=black };&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;column title unit class count month category dummy;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt; ** using ORDER=DATA does not have any impact without a;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt; ** usage of ORDER or GROUP on the report item -- so I took it off;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ** remember that default usage for character vars is DISPLAY;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ** and default usage for numeric vars is ANALYSIS SUM;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ** so the CALL DEFINE "reference" for COUNT is COUNT.SUM and for&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ** MONTH is MONTH.SUM;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; define title/ 'title';&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; define unit/ "unit";&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; define class/ 'class' ;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; define count/ 'count' ;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; define month/ 'month' ;&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp; &lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* hidden column containing color flag*/&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; /* will use NOPRINT later */&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; define category/ display ;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; define dummy / computed;&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;/* dummy column for traffic lighting*/&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;/* traffic light the data columns based on category*/&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;compute dummy/character length=100;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; ** make a temp variable big enough to hold whole style string;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; length svar $100;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt; if category in (1,2,3,4) then do;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; svar = catt('style={background=', put (category, colorflag.),'}');&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dummy = svar;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt; ** need different column reference for numeric vs character;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt; ** if COUNT and MONTH had been a usage or display, then it would have been OK;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt; ** to use the simple name. ;&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp; &lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; call define ('count.sum' , 'style', svar);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; call define ('month.sum', 'style', svar);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; call define ('class','style',svar);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt; end;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;endcomp;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ods html close; &lt;/STRONG&gt;&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/11775i663E3D89DDB8B135/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="correct_traffic_call_define.png" title="correct_traffic_call_define.png" /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Aug 2014 03:07:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Problem-Traffic-Lighting-with-Proc-Report/m-p/150007#M11574</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2014-08-06T03:07:10Z</dc:date>
    </item>
    <item>
      <title>Re: Problem Traffic Lighting with Proc Report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Problem-Traffic-Lighting-with-Proc-Report/m-p/150008#M11575</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much Cynthia! The report works and looks great, I really appreciate your quick and detailed response! (The parts of the code that were misspelled/ wrong parenthesis were due to my having to type out the code by hand (SAS is on a different computer without internet). Thanks again!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Aug 2014 12:09:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Problem-Traffic-Lighting-with-Proc-Report/m-p/150008#M11575</guid>
      <dc:creator>saiaca</dc:creator>
      <dc:date>2014-08-06T12:09:59Z</dc:date>
    </item>
  </channel>
</rss>

