<?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: color block in data step/proc report in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/color-block-in-data-step-proc-report/m-p/811224#M319963</link>
    <description>Hi all:  &lt;BR /&gt;Now I know the confusion came from. &lt;BR /&gt;Logic: Whenever SUBJECT OR  VISIT change, the COLORFLAG will change. is this clear now? thank you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;BR /&gt;for example: &lt;BR /&gt;SUBJECT VISIT COLORFLAG     LOGIC&lt;BR /&gt;102-001 Visit 1 white                   (starting value)&lt;BR /&gt;102-001 Visit 1 white                   ( no change-keep same color)&lt;BR /&gt;102-001 Visit 2                             (change value of VISIT)&lt;BR /&gt;121-002 Visit 1 white                   (change value of  subject and visit)&lt;BR /&gt;121-002 Visit 1 white                   (no change-keep same color)&lt;BR /&gt;121-002 Visit 2                             (change value of visit)&lt;BR /&gt;124-003 Visit 2 white                   (change value of subject )&lt;BR /&gt;124-003 Visit 2 white                   (no change-keep same color)&lt;BR /&gt;124-003 Visit 2 white                   (no change-keep same color)&lt;BR /&gt;125-002 visit 3                             (change value of subject and visit)&lt;BR /&gt;125-002 visit 3                            (no change-keep same color)&lt;BR /&gt;125-002 visit 3                            (no change-keep same color)&lt;BR /&gt;128-002 Visit 2 white                  (change value of subject and visit)&lt;BR /&gt;128-002 Visit 2 white                  (no change-keep same color)&lt;BR /&gt;128-002 Visit 2 white                 (no change-keep same color)&lt;BR /&gt;128-002 visit 3                           (change value of  visit)</description>
    <pubDate>Tue, 03 May 2022 14:00:23 GMT</pubDate>
    <dc:creator>purpleclothlady</dc:creator>
    <dc:date>2022-05-03T14:00:23Z</dc:date>
    <item>
      <title>color block in data step/proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/color-block-in-data-step-proc-report/m-p/810707#M319714</link>
      <description>&lt;P&gt;Hi all:&lt;/P&gt;
&lt;P&gt;I have the below dataset, and plan to output by subject and visit (want) using ODS report, how to do that in DataStep or Proc report ?&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data have;&lt;BR /&gt;input subject $7. visit $20.;&lt;BR /&gt;datalines;&lt;BR /&gt;102-001 Visit 1 &lt;BR /&gt;102-001 Visit 1 &lt;BR /&gt;102-001 Visit 2 &lt;BR /&gt;121-002 Visit 1 &lt;BR /&gt;121-002 Visit 1 &lt;BR /&gt;121-002 Visit 2 &lt;BR /&gt;124-003 Visit 2 &lt;BR /&gt;124-003 Visit 2 &lt;BR /&gt;124-003 Visit 2 &lt;BR /&gt;125-002 visit 3 &lt;BR /&gt;125-002 visit 3 &lt;BR /&gt;125-002 visit 3 &lt;BR /&gt;128-002 Visit 2 &lt;BR /&gt;128-002 Visit 2 &lt;BR /&gt;128-002 Visit 2 &lt;BR /&gt;128-002 visit 3&lt;BR /&gt;;run;&lt;BR /&gt;proc sort;by subject visit;run;&lt;/P&gt;
&lt;P&gt;/***want***/&lt;BR /&gt;102-001 Visit 1 white &lt;BR /&gt;102-001 Visit 1 white&lt;BR /&gt;102-001 Visit 2 &lt;BR /&gt;121-002 Visit 1 white&lt;BR /&gt;121-002 Visit 1 white&lt;BR /&gt;121-002 Visit 2 &lt;BR /&gt;124-003 Visit 2 white&lt;BR /&gt;124-003 Visit 2 white&lt;BR /&gt;124-003 Visit 2 white&lt;BR /&gt;125-002 visit 3 &lt;BR /&gt;125-002 visit 3 &lt;BR /&gt;125-002 visit 3 &lt;BR /&gt;128-002 Visit 2 white&lt;BR /&gt;128-002 Visit 2 white&lt;BR /&gt;128-002 Visit 2 white&lt;BR /&gt;128-002 visit 3&lt;/P&gt;</description>
      <pubDate>Fri, 29 Apr 2022 17:50:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/color-block-in-data-step-proc-report/m-p/810707#M319714</guid>
      <dc:creator>purpleclothlady</dc:creator>
      <dc:date>2022-04-29T17:50:57Z</dc:date>
    </item>
    <item>
      <title>Re: color block in data step/proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/color-block-in-data-step-proc-report/m-p/810708#M319715</link>
      <description>&lt;P&gt;There is no ODS REPORT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you mean PROC REPORT and ODS ____________ ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, can you please explain the logic here, and why you are typing "white" next to some rows and not other rows? Spend some time, give us a complete and clear explanation of the problem and the desired output, instead of the extremely brief explanation you gave.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Apr 2022 17:58:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/color-block-in-data-step-proc-report/m-p/810708#M319715</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-04-29T17:58:05Z</dc:date>
    </item>
    <item>
      <title>Re: color block in data step/proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/color-block-in-data-step-proc-report/m-p/810740#M319737</link>
      <description>&lt;P&gt;Hi Paige:&lt;/P&gt;
&lt;P&gt;The goal is to color code by subject and visit. the final output look like this when I output as excel , please see attachment or screen shot.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="purpleclothlady_0-1651263102913.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/70995i207C26502A621F12/image-size/medium?v=v2&amp;amp;px=400" role="button" title="purpleclothlady_0-1651263102913.png" alt="purpleclothlady_0-1651263102913.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thank you for helping.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Apr 2022 20:14:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/color-block-in-data-step-proc-report/m-p/810740#M319737</guid>
      <dc:creator>purpleclothlady</dc:creator>
      <dc:date>2022-04-29T20:14:16Z</dc:date>
    </item>
    <item>
      <title>Re: color block in data step/proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/color-block-in-data-step-proc-report/m-p/810741#M319738</link>
      <description>&lt;P&gt;Thanks. I don't see an answer to my earlier request:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;please explain the logic here, and why you are typing "white" next to some rows and not other rows? Spend some time, give us a complete and clear explanation of the problem and the desired output, instead of the extremely brief explanation you gave.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Fri, 29 Apr 2022 20:30:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/color-block-in-data-step-proc-report/m-p/810741#M319738</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-04-29T20:30:45Z</dc:date>
    </item>
    <item>
      <title>Re: color block in data step/proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/color-block-in-data-step-proc-report/m-p/810748#M319743</link>
      <description>Hi Paige:&lt;BR /&gt;Please ignore  column "white" I just want to give an example of look of the final dataset. &lt;BR /&gt; the goal is to output the dataset to excel and highlight cells by subject and visit, which I sent as a screen shot. Hopefully this explains the goal clearly.&lt;BR /&gt;&lt;BR /&gt;thanks,&lt;BR /&gt;purpleclothlady</description>
      <pubDate>Fri, 29 Apr 2022 20:55:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/color-block-in-data-step-proc-report/m-p/810748#M319743</guid>
      <dc:creator>purpleclothlady</dc:creator>
      <dc:date>2022-04-29T20:55:25Z</dc:date>
    </item>
    <item>
      <title>Re: color block in data step/proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/color-block-in-data-step-proc-report/m-p/810780#M319753</link>
      <description>&lt;P&gt;We're not communicating. I don't think you understand. I still don't see an explanation of the logic that determines which cell gets colored and which don't. I have asked twice for this logic, I don't see it. I have asked twice for "Spend some time, give us a complete and clear explanation of the problem and the desired output, instead of the extremely brief explanation you gave" and I don't see it.&lt;/P&gt;</description>
      <pubDate>Sat, 30 Apr 2022 09:35:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/color-block-in-data-step-proc-report/m-p/810780#M319753</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-04-30T09:35:09Z</dc:date>
    </item>
    <item>
      <title>Re: color block in data step/proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/color-block-in-data-step-proc-report/m-p/811124#M319928</link>
      <description>&lt;P&gt;hi all:&lt;/P&gt;
&lt;P&gt;data have;&lt;BR /&gt;input subject $7. visit $8.;&lt;BR /&gt;datalines;&lt;BR /&gt;102-001 Visit 1&lt;BR /&gt;102-001 Visit 1&lt;BR /&gt;102-001 Visit 2&lt;BR /&gt;121-002 Visit 1&lt;BR /&gt;121-002 Visit 1&lt;BR /&gt;121-002 Visit 2&lt;BR /&gt;124-003 Visit 2&lt;BR /&gt;124-003 Visit 2&lt;BR /&gt;124-003 Visit 2&lt;BR /&gt;125-002 visit 3&lt;BR /&gt;125-002 visit 3&lt;BR /&gt;125-002 visit 3&lt;BR /&gt;128-002 Visit 2&lt;BR /&gt;128-002 Visit 2&lt;BR /&gt;128-002 Visit 2&lt;BR /&gt;128-002 visit 3&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;proc sort;by subject visit;run;&lt;/P&gt;
&lt;P&gt;/&lt;FONT color="#800000"&gt;&lt;STRONG&gt;*Goal: Need to create a new variable: COLORFLAG using dataset HAVE */&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#800000"&gt;&lt;STRONG&gt;/*The final dataset WANT looks like this */&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;data want;&lt;BR /&gt;input subject $7. visit $8. colorflag $8.;&lt;BR /&gt;datalines;&lt;BR /&gt;102-001 Visit 1 white&lt;BR /&gt;102-001 Visit 1 white&lt;BR /&gt;102-001 Visit 2&lt;BR /&gt;121-002 Visit 1 white&lt;BR /&gt;121-002 Visit 1 white&lt;BR /&gt;121-002 Visit 2&lt;BR /&gt;124-003 Visit 2 white&lt;BR /&gt;124-003 Visit 2 white&lt;BR /&gt;124-003 Visit 2 white&lt;BR /&gt;125-002 visit 3&lt;BR /&gt;125-002 visit 3&lt;BR /&gt;125-002 visit 3&lt;BR /&gt;128-002 Visit 2 white&lt;BR /&gt;128-002 Visit 2 white&lt;BR /&gt;128-002 Visit 2 white&lt;BR /&gt;128-002 visit 3&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 May 2022 19:19:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/color-block-in-data-step-proc-report/m-p/811124#M319928</guid>
      <dc:creator>purpleclothlady</dc:creator>
      <dc:date>2022-05-02T19:19:58Z</dc:date>
    </item>
    <item>
      <title>Re: color block in data step/proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/color-block-in-data-step-proc-report/m-p/811132#M319936</link>
      <description>Hi:&lt;BR /&gt;  Although I see what you say you want,  I do not understand the logic of how you need to create a value for your COLORFLAG variable. For example, some Visit 1 rows have the COLORFLAG of white, but then some Visit 2 rows are also white for COLORFLAG. None of the Visit 3 rows have white for COLORFLAG. Can a Visit 3 ever have a COLORFLAG value of white? What is the difference between the Visit 1 rows and the Visit 2 rows. Are there only ever 3 visits? Can you ever have a Visit 4 or Visit 5? My guess is that you want the first visit number for a subject to get the color white for COLORFLAG and then the next visit number has the COLORFLAG set to either nothing or some other color. But I can't write a program based on a guess. Because when I look at 125-002, they only have Visit3 and they do not have white for COLORFLAG, so I don't understand the logic of how you are assigning values to COLORFLAG.&lt;BR /&gt;Cynthia</description>
      <pubDate>Mon, 02 May 2022 20:08:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/color-block-in-data-step-proc-report/m-p/811132#M319936</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2022-05-02T20:08:40Z</dc:date>
    </item>
    <item>
      <title>Re: color block in data step/proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/color-block-in-data-step-proc-report/m-p/811224#M319963</link>
      <description>Hi all:  &lt;BR /&gt;Now I know the confusion came from. &lt;BR /&gt;Logic: Whenever SUBJECT OR  VISIT change, the COLORFLAG will change. is this clear now? thank you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;BR /&gt;for example: &lt;BR /&gt;SUBJECT VISIT COLORFLAG     LOGIC&lt;BR /&gt;102-001 Visit 1 white                   (starting value)&lt;BR /&gt;102-001 Visit 1 white                   ( no change-keep same color)&lt;BR /&gt;102-001 Visit 2                             (change value of VISIT)&lt;BR /&gt;121-002 Visit 1 white                   (change value of  subject and visit)&lt;BR /&gt;121-002 Visit 1 white                   (no change-keep same color)&lt;BR /&gt;121-002 Visit 2                             (change value of visit)&lt;BR /&gt;124-003 Visit 2 white                   (change value of subject )&lt;BR /&gt;124-003 Visit 2 white                   (no change-keep same color)&lt;BR /&gt;124-003 Visit 2 white                   (no change-keep same color)&lt;BR /&gt;125-002 visit 3                             (change value of subject and visit)&lt;BR /&gt;125-002 visit 3                            (no change-keep same color)&lt;BR /&gt;125-002 visit 3                            (no change-keep same color)&lt;BR /&gt;128-002 Visit 2 white                  (change value of subject and visit)&lt;BR /&gt;128-002 Visit 2 white                  (no change-keep same color)&lt;BR /&gt;128-002 Visit 2 white                 (no change-keep same color)&lt;BR /&gt;128-002 visit 3                           (change value of  visit)</description>
      <pubDate>Tue, 03 May 2022 14:00:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/color-block-in-data-step-proc-report/m-p/811224#M319963</guid>
      <dc:creator>purpleclothlady</dc:creator>
      <dc:date>2022-05-03T14:00:23Z</dc:date>
    </item>
    <item>
      <title>Re: color block in data step/proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/color-block-in-data-step-proc-report/m-p/811268#M319968</link>
      <description>&lt;P&gt;So use BY group processing to create your COLORFLAG variable.&lt;/P&gt;
&lt;P&gt;It is probably easier to use binary variable, but with some extra IF/THEN logic you could create a text variable if you insist.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set have;
   by subject visit;
   retain colorflag 0;
   colorflag=mod(colorflag+first.visit,2);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 May 2022 16:01:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/color-block-in-data-step-proc-report/m-p/811268#M319968</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-05-03T16:01:55Z</dc:date>
    </item>
    <item>
      <title>Re: color block in data step/proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/color-block-in-data-step-proc-report/m-p/811269#M319969</link>
      <description>&lt;P&gt;Thanks everyone-Paige,&amp;nbsp;&lt;SPAN&gt;Cynthia &lt;/SPAN&gt;&amp;nbsp;for your help and time, you rock. this works !!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 May 2022 16:14:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/color-block-in-data-step-proc-report/m-p/811269#M319969</guid>
      <dc:creator>purpleclothlady</dc:creator>
      <dc:date>2022-05-03T16:14:34Z</dc:date>
    </item>
  </channel>
</rss>

