<?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 Retain Statement in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Retain-Statement/m-p/4556#M1846</link>
    <description>Hi gyes&lt;BR /&gt;
&lt;BR /&gt;
I have a code:&lt;BR /&gt;
&lt;B&gt;data &amp;amp;_output (drop = var1 var2);&lt;BR /&gt;
     set &amp;amp;syslast;&lt;BR /&gt;
     retain var1 var2;&lt;BR /&gt;
     if var1 ^= a then do...&lt;BR /&gt;
     ...&lt;BR /&gt;
     ...&lt;BR /&gt;
     ...&lt;BR /&gt;
run;&lt;/B&gt;&lt;BR /&gt;
&lt;BR /&gt;
My question is: what value will have &lt;B&gt;var1&lt;/B&gt; and &lt;B&gt;var2&lt;/B&gt; after &lt;I&gt;retain&lt;/I&gt; statement?&lt;BR /&gt;
&lt;BR /&gt;
Thanks.</description>
    <pubDate>Thu, 06 Sep 2007 08:39:17 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2007-09-06T08:39:17Z</dc:date>
    <item>
      <title>Retain Statement</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Retain-Statement/m-p/4556#M1846</link>
      <description>Hi gyes&lt;BR /&gt;
&lt;BR /&gt;
I have a code:&lt;BR /&gt;
&lt;B&gt;data &amp;amp;_output (drop = var1 var2);&lt;BR /&gt;
     set &amp;amp;syslast;&lt;BR /&gt;
     retain var1 var2;&lt;BR /&gt;
     if var1 ^= a then do...&lt;BR /&gt;
     ...&lt;BR /&gt;
     ...&lt;BR /&gt;
     ...&lt;BR /&gt;
run;&lt;/B&gt;&lt;BR /&gt;
&lt;BR /&gt;
My question is: what value will have &lt;B&gt;var1&lt;/B&gt; and &lt;B&gt;var2&lt;/B&gt; after &lt;I&gt;retain&lt;/I&gt; statement?&lt;BR /&gt;
&lt;BR /&gt;
Thanks.</description>
      <pubDate>Thu, 06 Sep 2007 08:39:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Retain-Statement/m-p/4556#M1846</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-09-06T08:39:17Z</dc:date>
    </item>
    <item>
      <title>Re: Retain Statement</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Retain-Statement/m-p/4557#M1847</link>
      <description>As you haven't coded a literal after VAR1 / VAR2 in your RETAIN statement, they will be set to missing values. What happens next depends whether they appear in &amp;amp;SYSLAST. If they do, the effect of RETAIN is redundant and VAR1 / VAR2 will get refreshed with every observation read. If they don't appear in &amp;amp;SYSLAST then they will stay missing until referenced explicitly in the DATA step.&lt;BR /&gt;
&lt;BR /&gt;
In your example, VAR1 / VAR2 could be missing for all time and VAR1 may never be equal to A - unless it appears in &amp;amp;SYSLAST.</description>
      <pubDate>Thu, 06 Sep 2007 12:44:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Retain-Statement/m-p/4557#M1847</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-09-06T12:44:02Z</dc:date>
    </item>
  </channel>
</rss>

