<?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: How To Control Retain Variable Value in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-To-Control-Retain-Variable-Value/m-p/149035#M29440</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;dishant&lt;/P&gt;&lt;P&gt;please&lt;/P&gt;&lt;P&gt;before I offer a solution&lt;/P&gt;&lt;P&gt;why!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is it really just a repeat of the first N obs where N goes from 1 to 5?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Peter Crawford&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 22 Jan 2014 10:53:02 GMT</pubDate>
    <dc:creator>Peter_C</dc:creator>
    <dc:date>2014-01-22T10:53:02Z</dc:date>
    <item>
      <title>How To Control Retain Variable Value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-To-Control-Retain-Variable-Value/m-p/149034#M29439</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My data set is Like This,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data chk;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input x;&lt;/P&gt;&lt;P&gt;&amp;nbsp; datalines;&lt;/P&gt;&lt;P&gt;12&lt;/P&gt;&lt;P&gt;23&lt;/P&gt;&lt;P&gt;34&lt;/P&gt;&lt;P&gt;11&lt;/P&gt;&lt;P&gt;45&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;Run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And My desired Output Look Like,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;12&lt;/P&gt;&lt;P&gt;12&lt;/P&gt;&lt;P&gt;23&lt;/P&gt;&lt;P&gt;12&lt;/P&gt;&lt;P&gt;23&lt;/P&gt;&lt;P&gt;34&lt;/P&gt;&lt;P&gt;12&lt;/P&gt;&lt;P&gt;23&lt;/P&gt;&lt;P&gt;34&lt;/P&gt;&lt;P&gt;11&lt;/P&gt;&lt;P&gt;12&lt;/P&gt;&lt;P&gt;23&lt;/P&gt;&lt;P&gt;34&lt;/P&gt;&lt;P&gt;11&lt;/P&gt;&lt;P&gt;45&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So Pls Guys Help Me out in this problem. Your Valuable Suggestion appreciate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks In Advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Dishant Parikh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jan 2014 10:12:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-To-Control-Retain-Variable-Value/m-p/149034#M29439</guid>
      <dc:creator>dishant</dc:creator>
      <dc:date>2014-01-22T10:12:06Z</dc:date>
    </item>
    <item>
      <title>Re: How To Control Retain Variable Value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-To-Control-Retain-Variable-Value/m-p/149035#M29440</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;dishant&lt;/P&gt;&lt;P&gt;please&lt;/P&gt;&lt;P&gt;before I offer a solution&lt;/P&gt;&lt;P&gt;why!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is it really just a repeat of the first N obs where N goes from 1 to 5?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Peter Crawford&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jan 2014 10:53:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-To-Control-Retain-Variable-Value/m-p/149035#M29440</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2014-01-22T10:53:02Z</dc:date>
    </item>
    <item>
      <title>Re: How To Control Retain Variable Value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-To-Control-Retain-Variable-Value/m-p/149036#M29441</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi peter,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Actually I am Creating one Macro This Solution Will Helpful me a lot.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can you help me to reach the required output ,it would be grateful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jan 2014 10:59:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-To-Control-Retain-Variable-Value/m-p/149036#M29441</guid>
      <dc:creator>dishant</dc:creator>
      <dc:date>2014-01-22T10:59:44Z</dc:date>
    </item>
    <item>
      <title>Re: How To Control Retain Variable Value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-To-Control-Retain-Variable-Value/m-p/149037#M29442</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-size: 9.0pt; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; fun;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; y= &lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 9.0pt; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt; &lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;to&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; _n_ ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; chk point= y ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;output&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; _n_ &amp;gt;= &lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 9.0pt; font-family: 'Courier New';"&gt;5&lt;/STRONG&gt; &lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;stop&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-size: 9.0pt; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jan 2014 11:00:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-To-Control-Retain-Variable-Value/m-p/149037#M29442</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2014-01-22T11:00:58Z</dc:date>
    </item>
    <item>
      <title>Re: How To Control Retain Variable Value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-To-Control-Retain-Variable-Value/m-p/149038#M29443</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Hi Peter,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Thanks A lot For giving the answer and your valuable time.&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;This Solution Will Helpful me a lot&lt;/SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;One More Question we can do with the any other logic or procedure?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jan 2014 11:05:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-To-Control-Retain-Variable-Value/m-p/149038#M29443</guid>
      <dc:creator>dishant</dc:creator>
      <dc:date>2014-01-22T11:05:19Z</dc:date>
    </item>
    <item>
      <title>Re: How To Control Retain Variable Value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-To-Control-Retain-Variable-Value/m-p/149039#M29444</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why is that not an adequate anserr?&lt;/P&gt;&lt;P&gt;did your One Macro need something else?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Peter Crawford&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jan 2014 12:26:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-To-Control-Retain-Variable-Value/m-p/149039#M29444</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2014-01-22T12:26:07Z</dc:date>
    </item>
    <item>
      <title>Re: How To Control Retain Variable Value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-To-Control-Retain-Variable-Value/m-p/149040#M29445</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Peter,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;yeah obviously its &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;adequate &lt;/SPAN&gt;answer and it takes me new level of thinking but as per your logic we need to pass total _n_&amp;nbsp; in if condition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If suppose data get updated and few more observation added then again we need to change the if condition right?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So is their any logic in dynamic way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks In advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jan 2014 04:48:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-To-Control-Retain-Variable-Value/m-p/149040#M29445</guid>
      <dc:creator>dishant</dc:creator>
      <dc:date>2014-01-23T04:48:07Z</dc:date>
    </item>
    <item>
      <title>Re: How To Control Retain Variable Value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-To-Control-Retain-Variable-Value/m-p/149041#M29446</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;what error messages are you getting?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jan 2014 08:15:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-To-Control-Retain-Variable-Value/m-p/149041#M29446</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2014-01-23T08:15:06Z</dc:date>
    </item>
    <item>
      <title>Re: How To Control Retain Variable Value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-To-Control-Retain-Variable-Value/m-p/149042#M29447</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you visit the online documentation regarding the SET statement you will find the NOBS option.&amp;nbsp; Which should suffice for what you call "total _N_".&lt;/P&gt;&lt;DIV style="font-family: Courier New; font-size: 9pt;"&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;data&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; chk;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; x;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;datalines&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffc0;"&gt;12&lt;BR /&gt;23&lt;BR /&gt;34&lt;BR /&gt;11&lt;BR /&gt;45&lt;BR /&gt;&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;Run&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;data&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; fun;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; group = _n_;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; y= &lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;to&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; _n_;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; chk &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;point&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;=y &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;nobs&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;=nobs;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;output&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;end&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; _n_ &amp;gt;= nobs &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;stop&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;run&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;print&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;run&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jan 2014 11:49:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-To-Control-Retain-Variable-Value/m-p/149042#M29447</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2014-01-23T11:49:07Z</dc:date>
    </item>
  </channel>
</rss>

