<?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: prevent temporary variable from retaining in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/prevent-temporary-variable-from-retaining/m-p/47688#M6192</link>
    <description>Thanks for the reply. Actually, that was just an example. I have a complex situation where I do &lt;U&gt;not&lt;/U&gt; want to retain the temporary variable created in the compute block. I am glad that I now have a solution for my this.</description>
    <pubDate>Wed, 27 Jan 2010 14:10:51 GMT</pubDate>
    <dc:creator>NickR</dc:creator>
    <dc:date>2010-01-27T14:10:51Z</dc:date>
    <item>
      <title>prevent temporary variable from retaining</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/prevent-temporary-variable-from-retaining/m-p/47684#M6188</link>
      <description>Hello,&lt;BR /&gt;
&lt;BR /&gt;
In proc report, by default, temporary variable created in a compute block will be retained. Is there a way to prevent this temporary variable from retaining?&lt;BR /&gt;
&lt;BR /&gt;
e.g.&lt;BR /&gt;
&lt;BR /&gt;
data check;&lt;BR /&gt;
    count1 = 5;&lt;BR /&gt;
    do count2 = 1 to 10;&lt;BR /&gt;
        output;&lt;BR /&gt;
    end;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc report data=check nowd;&lt;BR /&gt;
      column count1 count2;&lt;BR /&gt;
      define count1 /order order=internal;&lt;BR /&gt;
      define count2 /order order=internal;&lt;BR /&gt;
&lt;BR /&gt;
      compute before count1;&lt;BR /&gt;
            newvar = 1;  *&lt;B&gt;Can we prevent 'newvar' from retaining??;&lt;/B&gt;&lt;BR /&gt;
      endcomp;&lt;BR /&gt;
&lt;BR /&gt;
      compute before count2;&lt;BR /&gt;
          if newvar=1 then do; text='Test'; vlen=50; end; &lt;B&gt;*I want to print this line only for the first obs;&lt;/B&gt;&lt;BR /&gt;
          else do; text=''; vlen=0;end;&lt;BR /&gt;
          line text $varying. vlen;&lt;BR /&gt;
      endcomp;&lt;BR /&gt;
run;</description>
      <pubDate>Tue, 26 Jan 2010 23:04:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/prevent-temporary-variable-from-retaining/m-p/47684#M6188</guid>
      <dc:creator>NickR</dc:creator>
      <dc:date>2010-01-26T23:04:43Z</dc:date>
    </item>
    <item>
      <title>Re: prevent temporary variable from retaining</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/prevent-temporary-variable-from-retaining/m-p/47685#M6189</link>
      <description>You can change that behavior of the proc but you can change the value of newvar.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data check;&lt;BR /&gt;
   do count1 = 5,10;&lt;BR /&gt;
      do count2 = 1 to 10;&lt;BR /&gt;
         output;&lt;BR /&gt;
         end;&lt;BR /&gt;
      end;&lt;BR /&gt;
   run;&lt;BR /&gt;
&lt;BR /&gt;
proc report data=check nowd list;&lt;BR /&gt;
   column count1 count2;&lt;BR /&gt;
   define count1 /order order=internal;&lt;BR /&gt;
   define count2 /order order=internal;&lt;BR /&gt;
   &lt;BR /&gt;
   compute before count1;&lt;BR /&gt;
      newvar + 1; &lt;BR /&gt;
      endcomp;&lt;BR /&gt;
&lt;BR /&gt;
   compute before count2;&lt;BR /&gt;
      rc = seenum(newvar);&lt;BR /&gt;
      text='Test'; &lt;BR /&gt;
      if newvar = 1 then do; &lt;BR /&gt;
         vlen   = 50; &lt;BR /&gt;
         newvar = 2;&lt;BR /&gt;
         end; *I want to print this line only for the first obs;&lt;BR /&gt;
      else do; &lt;BR /&gt;
         vlen=0;&lt;BR /&gt;
         end;&lt;BR /&gt;
      line text $varying. vlen;&lt;BR /&gt;
      endcomp;&lt;BR /&gt;
   run; &lt;BR /&gt;
[/pre]</description>
      <pubDate>Wed, 27 Jan 2010 03:01:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/prevent-temporary-variable-from-retaining/m-p/47685#M6189</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2010-01-27T03:01:20Z</dc:date>
    </item>
    <item>
      <title>Re: prevent temporary variable from retaining</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/prevent-temporary-variable-from-retaining/m-p/47686#M6190</link>
      <description>this helps...thanks a lot!!!</description>
      <pubDate>Wed, 27 Jan 2010 04:12:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/prevent-temporary-variable-from-retaining/m-p/47686#M6190</guid>
      <dc:creator>NickR</dc:creator>
      <dc:date>2010-01-27T04:12:41Z</dc:date>
    </item>
    <item>
      <title>Re: prevent temporary variable from retaining</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/prevent-temporary-variable-from-retaining/m-p/47687#M6191</link>
      <description>Hi:&lt;BR /&gt;
  You may not need to calculate NEWVAR at all. A simple COMPUTE BEFORE will only execute at the "top" of the report.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia&lt;BR /&gt;
[pre]&lt;BR /&gt;
ods listing close;&lt;BR /&gt;
ods html file='c:\temp\newvar.html' style=sasweb;&lt;BR /&gt;
                       &lt;BR /&gt;
proc report data=check nowd;&lt;BR /&gt;
column count1 count2;&lt;BR /&gt;
define count1 /order order=internal;&lt;BR /&gt;
define count2 /order order=internal;&lt;BR /&gt;
                    &lt;BR /&gt;
compute before;&lt;BR /&gt;
    text='Test'; &lt;BR /&gt;
    vlen=50; &lt;BR /&gt;
    line text $varying. vlen;&lt;BR /&gt;
endcomp;&lt;BR /&gt;
run; &lt;BR /&gt;
ods html close;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Wed, 27 Jan 2010 04:47:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/prevent-temporary-variable-from-retaining/m-p/47687#M6191</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-01-27T04:47:32Z</dc:date>
    </item>
    <item>
      <title>Re: prevent temporary variable from retaining</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/prevent-temporary-variable-from-retaining/m-p/47688#M6192</link>
      <description>Thanks for the reply. Actually, that was just an example. I have a complex situation where I do &lt;U&gt;not&lt;/U&gt; want to retain the temporary variable created in the compute block. I am glad that I now have a solution for my this.</description>
      <pubDate>Wed, 27 Jan 2010 14:10:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/prevent-temporary-variable-from-retaining/m-p/47688#M6192</guid>
      <dc:creator>NickR</dc:creator>
      <dc:date>2010-01-27T14:10:51Z</dc:date>
    </item>
  </channel>
</rss>

