<?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: using the value of another field in a Proc Report compute block in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/using-the-value-of-another-field-in-a-Proc-Report-compute-block/m-p/277619#M55765</link>
    <description>&lt;P&gt;PROC REPORT processes columns from left to right. Because square is to the left of topzip, topzip is not defined when the compute block for square is executed. I see that topzip is a non-printing column, so you should be able to just move it to precede square in the COLUMN statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 15 Jun 2016 17:32:58 GMT</pubDate>
    <dc:creator>Tim_SAS</dc:creator>
    <dc:date>2016-06-15T17:32:58Z</dc:date>
    <item>
      <title>using the value of another field in a Proc Report compute block</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-the-value-of-another-field-in-a-Proc-Report-compute-block/m-p/277616#M55764</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have&amp;nbsp; test program and want to control the style of one field based on the value of another field in Proc report.&amp;nbsp; The&amp;nbsp;program I wrote to test this is below.&amp;nbsp; The computed block doesn't work as the value of topzip is uninitialized.&amp;nbsp; But it appears in the check debug file.&amp;nbsp; ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;--Ben&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data pcts; &amp;nbsp;&lt;BR /&gt;input cust pct zip;&lt;BR /&gt;topzip+1;&amp;nbsp; &lt;BR /&gt;if lag(cust)^=cust then topzip=1;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;cards;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;1 53 43058 &lt;BR /&gt;1 17 43220 &lt;BR /&gt;1 12 43235 &lt;BR /&gt;1 7&amp;nbsp; 43081 &lt;BR /&gt;1 4&amp;nbsp; 43214 &lt;BR /&gt;;;;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;proc format; &lt;BR /&gt;picture pct low-high= '000% of your clients reside in ';&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;run;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;ods escapechar='^';&amp;nbsp; &lt;BR /&gt;&amp;nbsp; &lt;BR /&gt;options papersize=(1.5in 2.4in);&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp; &lt;BR /&gt;proc report data=pcts split='\' out=check; &lt;BR /&gt;&amp;nbsp;&amp;nbsp; by cust;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; column square pct zip topzip; &lt;BR /&gt;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp; define topzip /noprint; &lt;BR /&gt;&amp;nbsp;&amp;nbsp; define pct&amp;nbsp;&amp;nbsp;&amp;nbsp; /display format=pct. '^{unicode ''2605''x}' color=red width=10 flow right;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; define zip&amp;nbsp;&amp;nbsp;&amp;nbsp; /display&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'You are located here' color=red left; &lt;BR /&gt;&amp;nbsp;&amp;nbsp; define square /display computed '';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; compute square /character length=20; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; square='^{unicode ''220e''x}';&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if topzip=1 then call define('square','style','style={color=red}');&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if topzip=2 then call define('square','style','style={color=green}'); &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if topzip=3 then call define('square','style','style={color=black}');&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if topzip=4 then call define('square','style','style={color=orange}'); &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if topzip=5 then call define('square','style','style={color=blue}'); &lt;BR /&gt;&amp;nbsp;&amp;nbsp; endcomp;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:22:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-the-value-of-another-field-in-a-Proc-Report-compute-block/m-p/277616#M55764</guid>
      <dc:creator>BenConner</dc:creator>
      <dc:date>2016-06-15T17:22:10Z</dc:date>
    </item>
    <item>
      <title>Re: using the value of another field in a Proc Report compute block</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-the-value-of-another-field-in-a-Proc-Report-compute-block/m-p/277619#M55765</link>
      <description>&lt;P&gt;PROC REPORT processes columns from left to right. Because square is to the left of topzip, topzip is not defined when the compute block for square is executed. I see that topzip is a non-printing column, so you should be able to just move it to precede square in the COLUMN statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:32:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-the-value-of-another-field-in-a-Proc-Report-compute-block/m-p/277619#M55765</guid>
      <dc:creator>Tim_SAS</dc:creator>
      <dc:date>2016-06-15T17:32:58Z</dc:date>
    </item>
    <item>
      <title>Re: using the value of another field in a Proc Report compute block</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-the-value-of-another-field-in-a-Proc-Report-compute-block/m-p/277620#M55766</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;   column topzip square pct zip; 
   define topzip / display noprint; 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:36:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-the-value-of-another-field-in-a-Proc-Report-compute-block/m-p/277620#M55766</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2016-06-15T17:36:33Z</dc:date>
    </item>
    <item>
      <title>Re: using the value of another field in a Proc Report compute block</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-the-value-of-another-field-in-a-Proc-Report-compute-block/m-p/277621#M55767</link>
      <description>&lt;P&gt;Thanks much!&amp;nbsp; I had it originally on the left side but had also left out the DISPLAY parameter.&amp;nbsp; It generated the same 'unitialized' warning when it was not there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This stuff is really slick... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-Ben&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:45:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-the-value-of-another-field-in-a-Proc-Report-compute-block/m-p/277621#M55767</guid>
      <dc:creator>BenConner</dc:creator>
      <dc:date>2016-06-15T17:45:32Z</dc:date>
    </item>
    <item>
      <title>Re: using the value of another field in a Proc Report compute block</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-the-value-of-another-field-in-a-Proc-Report-compute-block/m-p/277624#M55768</link>
      <description>&lt;P&gt;The default for numeric is to summarize so the name of the statistic associated with topzip would be something like topzip.sum (I think). &amp;nbsp;I don't use PROC REPORT for summary but, I often make the same omission of type.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:51:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-the-value-of-another-field-in-a-Proc-Report-compute-block/m-p/277624#M55768</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2016-06-15T17:51:50Z</dc:date>
    </item>
  </channel>
</rss>

