<?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: automatically retained in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/automatically-retained/m-p/390088#M93545</link>
    <description>&lt;P&gt;My answer is not quite right. You should mark &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp;answer as the correct answer instead.&lt;/P&gt;</description>
    <pubDate>Wed, 23 Aug 2017 03:23:39 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2017-08-23T03:23:39Z</dc:date>
    <item>
      <title>automatically retained</title>
      <link>https://communities.sas.com/t5/SAS-Programming/automatically-retained/m-p/390077#M93539</link>
      <description>&lt;P&gt;Hi SAS experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when I ran the following program, I found y was automatically retained for x=4 in data test2. What happed?&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;data test;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;input x y;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;cards;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;1 .&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;3 .&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;data test1;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;input x;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;cards;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;3&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;4&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;;&lt;BR /&gt;run;&lt;BR /&gt;data test2;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;set test(in=a)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; test1(in=b);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if b then do;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if x=3 then y=4;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;end;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Aug 2017 02:03:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/automatically-retained/m-p/390077#M93539</guid>
      <dc:creator>fbl204653</dc:creator>
      <dc:date>2017-08-23T02:03:26Z</dc:date>
    </item>
    <item>
      <title>Re: automatically retained</title>
      <link>https://communities.sas.com/t5/SAS-Programming/automatically-retained/m-p/390081#M93541</link>
      <description>&lt;P&gt;There is no y variable in dataset test1 so&amp;nbsp;the value of y isn't reset to missing when test1 is read.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Aug 2017 02:57:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/automatically-retained/m-p/390081#M93541</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-08-23T02:57:14Z</dc:date>
    </item>
    <item>
      <title>Re: automatically retained</title>
      <link>https://communities.sas.com/t5/SAS-Programming/automatically-retained/m-p/390083#M93542</link>
      <description>&lt;P&gt;Any variable that comes from any SAS data set is automatically retained. &amp;nbsp;Since Y comes from a SAS data set, it is automatically retained.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A small complication: &amp;nbsp;when switching data sets (from TEST to TEST1 in the SET statement), Y is reset to missing. &amp;nbsp;You can see that by adding this statement after the SET statement:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;put Y;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But once Y is set to 4, it remains 4 (unless changed by subsequent programming statements). &amp;nbsp;As &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats&lt;/a&gt;&amp;nbsp;said, reading an observation from TEST1 does not replace Y.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Aug 2017 03:01:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/automatically-retained/m-p/390083#M93542</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-08-23T03:01:16Z</dc:date>
    </item>
    <item>
      <title>Re: automatically retained</title>
      <link>https://communities.sas.com/t5/SAS-Programming/automatically-retained/m-p/390085#M93543</link>
      <description>&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 23 Aug 2017 03:08:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/automatically-retained/m-p/390085#M93543</guid>
      <dc:creator>fbl204653</dc:creator>
      <dc:date>2017-08-23T03:08:35Z</dc:date>
    </item>
    <item>
      <title>Re: automatically retained</title>
      <link>https://communities.sas.com/t5/SAS-Programming/automatically-retained/m-p/390086#M93544</link>
      <description>Thanks!</description>
      <pubDate>Wed, 23 Aug 2017 03:10:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/automatically-retained/m-p/390086#M93544</guid>
      <dc:creator>fbl204653</dc:creator>
      <dc:date>2017-08-23T03:10:07Z</dc:date>
    </item>
    <item>
      <title>Re: automatically retained</title>
      <link>https://communities.sas.com/t5/SAS-Programming/automatically-retained/m-p/390088#M93545</link>
      <description>&lt;P&gt;My answer is not quite right. You should mark &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp;answer as the correct answer instead.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Aug 2017 03:23:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/automatically-retained/m-p/390088#M93545</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-08-23T03:23:39Z</dc:date>
    </item>
  </channel>
</rss>

