<?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: circular reference problem in SAS in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/circular-reference-problem-in-SAS/m-p/590196#M15006</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/185449"&gt;@ubshams&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Yes, and thanks and taht has been fixed to set. However I am still getting missing values in first forecast periods and onwards.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You have to rebuild your previous version of "have" from the beginning or a previous step as you have overwritten the one you had. Has that been done?&lt;/P&gt;</description>
    <pubDate>Thu, 19 Sep 2019 20:36:19 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-09-19T20:36:19Z</dc:date>
    <item>
      <title>circular reference problem in SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/circular-reference-problem-in-SAS/m-p/590185#M15003</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;I am trying to create some forecasts (has to be calculated mathematically) in SAS. The sample data and forecasts' nature is shown attached.&amp;nbsp;I can do it in Excel, but no able to do it in SAS. I am using the "Retain" statement in SAS but that doesn't seem to work for me. I get missing values in the forecast periods.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here, month 0 is the last period of "actuals" and forecasts begin from month 1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;set have;&lt;BR /&gt;retain variable2;&lt;BR /&gt;if month&amp;lt;=1 then do;&lt;BR /&gt;variable2 = lag1(variable1);&lt;BR /&gt;variable1_f=variable1;&lt;BR /&gt;end;&lt;BR /&gt;else do;&lt;/P&gt;&lt;P&gt;variable4 = variable3*variable2;&lt;BR /&gt;variable6 = variable5*variable2;&lt;BR /&gt;variable1_f = variable2+variable6-variable4&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Excel output is attached (which works).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/32625iCB31CB4E040EC1A5/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can this be implemented in SAS? Thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2019 20:56:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/circular-reference-problem-in-SAS/m-p/590185#M15003</guid>
      <dc:creator>ubshams</dc:creator>
      <dc:date>2019-09-19T20:56:48Z</dc:date>
    </item>
    <item>
      <title>Re: circular reference problem in SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/circular-reference-problem-in-SAS/m-p/590189#M15004</link>
      <description>&lt;P&gt;This&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
data have;
retain variable2;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;creates an empty dataset "want", and then creates a dataset "have" without using any input data. I strongly guess you wanted&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
retain variable2;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Sep 2019 20:21:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/circular-reference-problem-in-SAS/m-p/590189#M15004</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-09-19T20:21:44Z</dc:date>
    </item>
    <item>
      <title>Re: circular reference problem in SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/circular-reference-problem-in-SAS/m-p/590193#M15005</link>
      <description>&lt;P&gt;Yes, and thanks and taht has been fixed to set. However I am still getting missing values in first forecast periods and onwards.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2019 20:30:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/circular-reference-problem-in-SAS/m-p/590193#M15005</guid>
      <dc:creator>ubshams</dc:creator>
      <dc:date>2019-09-19T20:30:47Z</dc:date>
    </item>
    <item>
      <title>Re: circular reference problem in SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/circular-reference-problem-in-SAS/m-p/590196#M15006</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/185449"&gt;@ubshams&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Yes, and thanks and taht has been fixed to set. However I am still getting missing values in first forecast periods and onwards.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You have to rebuild your previous version of "have" from the beginning or a previous step as you have overwritten the one you had. Has that been done?&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2019 20:36:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/circular-reference-problem-in-SAS/m-p/590196#M15006</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-09-19T20:36:19Z</dc:date>
    </item>
    <item>
      <title>Re: circular reference problem in SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/circular-reference-problem-in-SAS/m-p/590202#M15007</link>
      <description>&lt;P&gt;Yes and i just re-ran everything and all pervious data steps.&lt;/P&gt;&lt;P&gt;Still same issue (missing values).Variable2 (which is lag of variable1) gets created untill the first month. Then nothing.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The other variables are just missing values.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2019 20:56:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/circular-reference-problem-in-SAS/m-p/590202#M15007</guid>
      <dc:creator>ubshams</dc:creator>
      <dc:date>2019-09-19T20:56:22Z</dc:date>
    </item>
    <item>
      <title>Re: circular reference problem in SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/circular-reference-problem-in-SAS/m-p/590205#M15008</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/185449"&gt;@ubshams&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Yes and i just re-ran everything and all pervious data steps.&lt;/P&gt;
&lt;P&gt;Still same issue (missing values).Variable2 (which is lag of variable1) gets created untill the first month. Then nothing.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The other variables are just missing values.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;LAG is a queue function and when use the Lag function after an if statement it tends to do things in a manner that takes a lot of time to figure out, basically the "last" value used by the lag is the previous record that the If was true, not the immediately previous record you may expect.&lt;/P&gt;
&lt;P&gt;If you always want to have the previous record value modify your code so that lag is executed outside of the if. And that likely means you don't always want that value in the output so drop it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data want;
   set have;
   retain variable2;
   &lt;FONT color="#0000ff"&gt;lv1 = lag(variable1);
&lt;/FONT&gt;   if month&amp;lt;=1 then do;
      &lt;FONT color="#0000ff"&gt;variable2 = lv1;
&lt;/FONT&gt;      variable1_f=variable1;
   end;
   else do;

      variable4 = variable3*variable2;
      variable6 = variable5*variable2;
      variable1_f = variable2+variable6-variable4 ;
   end;
   &lt;FONT color="#0000ff"&gt;drop lv1;
&lt;/FONT&gt;run;
&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Sep 2019 21:03:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/circular-reference-problem-in-SAS/m-p/590205#M15008</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-09-19T21:03:51Z</dc:date>
    </item>
    <item>
      <title>Re: circular reference problem in SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/circular-reference-problem-in-SAS/m-p/590207#M15009</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/185449"&gt;@ubshams&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe I'm missing something, but shouldn't the Lag() be used in both parts of IF/THEN/ELSE?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;all the best&lt;/P&gt;&lt;P&gt;Bart&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;look at the code here:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input month variable1 variable2 variable3 variable5;
cards;
-2 501       500 0.10 0.05
-1 502         . 0.09 0.05
 0 510         . 0.08 0.05
 1 499.8       . 0.07 0.05
 2 484.806     . 0.08 0.05
 3 465.41376   . 0.09 0.05
 4    .        . 0.10 0.05
 5    .        . 0.10 0.05
 6    .        . 0.06 0.05
;
run;

data want;
  set have;
  retain variable2 500;

  lag1_variable1 = lag1(variable1);

  if month&amp;lt;=1 then 
    do;
      variable2 = variable2 &amp;lt;&amp;gt; lag1_variable1;
      variable1_f=variable1;
    end;
  else 
    do;  
      variable4 = variable3*lag1_variable1;
      variable6 = variable5*lag1_variable1;
      variable1_f = lag1_variable1 + variable6-variable4 ;
    end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Sep 2019 21:16:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/circular-reference-problem-in-SAS/m-p/590207#M15009</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2019-09-19T21:16:00Z</dc:date>
    </item>
    <item>
      <title>Re: circular reference problem in SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/circular-reference-problem-in-SAS/m-p/590221#M15010</link>
      <description>&lt;P&gt;Thanks Yabwon.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am not sure. i didn't know you could use a statement like that with equal sign and &amp;lt;&amp;gt; together.&lt;/P&gt;
&lt;P&gt;The problem i am having is that how do i calculate the forecasts for all variables (variable1, variable2, variable4 and variable 6 all the way to month 6?&lt;/P&gt;
&lt;P&gt;I can do it in excel one by one, but SAS just stops and gives me missing values. Variable 3 and Variable5 forecasts are already given.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2019 21:57:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/circular-reference-problem-in-SAS/m-p/590221#M15010</guid>
      <dc:creator>ubshams</dc:creator>
      <dc:date>2019-09-19T21:57:16Z</dc:date>
    </item>
    <item>
      <title>Re: circular reference problem in SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/circular-reference-problem-in-SAS/m-p/590280#M15018</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/185449"&gt;@ubshams&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;could you modify my input data code to look like your starting point (which values are give)? and confirm rules you are using for calculating prediction? we will be on the same pare and it will be easier to figure it out&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All the best&lt;/P&gt;&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2019 06:44:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/circular-reference-problem-in-SAS/m-p/590280#M15018</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2019-09-20T06:44:33Z</dc:date>
    </item>
    <item>
      <title>Re: circular reference problem in SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/circular-reference-problem-in-SAS/m-p/590418#M15035</link>
      <description>&lt;P&gt;Ok,&amp;nbsp;thanks!&amp;nbsp;&amp;nbsp;Here you go updated data input and formulas for predictions:&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; have;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; month variable1 variable2 variable3 variable4 variable5 variable6;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;cards&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-2 501 500 0.10 100 0.05 601&lt;/P&gt;
&lt;P&gt;-1 502 501 0.09 45.09 0.05 25.05&lt;/P&gt;
&lt;P&gt;0 510 502 0.08 40.16 0.05 25.1&lt;/P&gt;
&lt;P&gt;1 . . 0.07 . 0.05 .&lt;/P&gt;
&lt;P&gt;2 . . 0.08 . 0.05 .&lt;/P&gt;
&lt;P&gt;3 . . 0.09 . 0.05 .&lt;/P&gt;
&lt;P&gt;4 . . 0.10 . 0.05 .&lt;/P&gt;
&lt;P&gt;5 . . 0.10 . 0.05 .&lt;/P&gt;
&lt;P&gt;6 . . 0.06 . 0.06 .&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/*****formulas to produce predictions through period 6 (end of dataset)*****/&lt;/P&gt;
&lt;P&gt;*variable2 = lag(variable1);&lt;/P&gt;
&lt;P&gt;*variable4 = variable3*variable2;&lt;/P&gt;
&lt;P&gt;*variable6 = variable5 * variable2;&lt;/P&gt;
&lt;P&gt;*variable1 = variable2 + variable6 - variable4;&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;/*****End of formulas to produce predictions*******************************/&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2019 14:27:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/circular-reference-problem-in-SAS/m-p/590418#M15035</guid>
      <dc:creator>ubshams</dc:creator>
      <dc:date>2019-09-20T14:27:55Z</dc:date>
    </item>
    <item>
      <title>Re: circular reference problem in SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/circular-reference-problem-in-SAS/m-p/590423#M15038</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/185449"&gt;@ubshams&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the following one:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  retain var1lag; drop var1lag;
   
  if month &amp;gt; 0 then
    do;
      variable2 = var1lag;
      variable4 = variable3 * variable2;
      variable6 = variable5 * variable2;
      variable1 = variable2 + variable6 - variable4;

      var1lag = variable1  ;
    end;
  else var1lag = lag(variable1);   
run;
proc print data = want;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;gave:&lt;/P&gt;&lt;PRE&gt;Obs    month    variable1    variable2    variable3    variable4    variable5    variable6

 1       -2      501.000      500.000        0.10       100.000        0.05       601.000
 2       -1      502.000      501.000        0.09        45.090        0.05        25.050
 3        0      510.000      502.000        0.08        40.160        0.05        25.100
 4        1      491.960      502.000        0.07        35.140        0.05        25.100
 5        2      477.201      491.960        0.08        39.357        0.05        24.598
 6        3      458.113      477.201        0.09        42.948        0.05        23.860
 7        4      435.207      458.113        0.10        45.811        0.05        22.906
 8        5      413.447      435.207        0.10        43.521        0.05        21.760
 9        6      413.447      413.447        0.06        24.807        0.06        24.807&lt;/PRE&gt;&lt;P&gt;is it the expected output?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All the best&lt;/P&gt;&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2019 14:47:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/circular-reference-problem-in-SAS/m-p/590423#M15038</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2019-09-20T14:47:06Z</dc:date>
    </item>
    <item>
      <title>Re: circular reference problem in SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/circular-reference-problem-in-SAS/m-p/590442#M15047</link>
      <description>&lt;P&gt;Almost, in Month 1 variable2 needs to equal 510 (which is the previous month's value for Variable1). But now&amp;nbsp;Variable2 is&amp;nbsp;502&amp;nbsp;(which is previous period&amp;nbsp;value of variable2).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2019 15:24:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/circular-reference-problem-in-SAS/m-p/590442#M15047</guid>
      <dc:creator>ubshams</dc:creator>
      <dc:date>2019-09-20T15:24:58Z</dc:date>
    </item>
    <item>
      <title>Re: circular reference problem in SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/circular-reference-problem-in-SAS/m-p/590443#M15048</link>
      <description>&lt;P&gt;This one seems to be doing it:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  retain var1lag; drop var1lag;
   
  if month &amp;gt; 0 then
    do;
      variable2 = var1lag;
      variable4 = variable3 * variable2;
      variable6 = variable5 * variable2;
      variable1 = variable2 + variable6 - variable4;   
    end;
 var1lag = variable1; 
 
run;
proc print data = want;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2019 15:30:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/circular-reference-problem-in-SAS/m-p/590443#M15048</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2019-09-20T15:30:01Z</dc:date>
    </item>
    <item>
      <title>Re: circular reference problem in SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/circular-reference-problem-in-SAS/m-p/590474#M15064</link>
      <description>&lt;P&gt;Thanks Bart, it works now.&lt;/P&gt;
&lt;P&gt;On a related matter. If I want to create a new variable, let's say variable7, which, in each of the predicted time periods, &amp;nbsp;just multiplies "the month 0" value of variable5" with the respective value of variable2, is there a way to code that up? Right now I am&amp;nbsp;just hard coding that number (which is not that efficient).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For e.g. I want variable7 in time 1 to be Variable2 value at month1 multiplied by Variable5 value in month 0. Then I want Variable7 in time 2 to be Variable5 value in month 0 to be multiplied by variable2 value in month 2. ...and so on.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2019 16:56:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/circular-reference-problem-in-SAS/m-p/590474#M15064</guid>
      <dc:creator>ubshams</dc:creator>
      <dc:date>2019-09-20T16:56:43Z</dc:date>
    </item>
    <item>
      <title>Re: circular reference problem in SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/circular-reference-problem-in-SAS/m-p/590479#M15065</link>
      <description>&lt;P&gt;Do you mean something like that:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  retain var1lag Var5_at_0; drop var1lag Var5_at_0;
   
  if month &amp;gt; 0 then
    do;
      variable2 = var1lag;
      variable4 = variable3 * variable2;
      variable6 = variable5 * variable2;
      variable1 = variable2 + variable6 - variable4;  
      
      variable7 =   variable2 * Var5_at_0;
    end;
 var1lag = variable1; 

  if month = 0  then Var5_at_0 = variable5;
 
run;
proc print data = want;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2019 17:12:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/circular-reference-problem-in-SAS/m-p/590479#M15065</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2019-09-20T17:12:35Z</dc:date>
    </item>
    <item>
      <title>Re: circular reference problem in SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/circular-reference-problem-in-SAS/m-p/590544#M15068</link>
      <description>&lt;P&gt;Thanks Bart. That's a clever trick with the if statement. It worked!&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2019 20:09:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/circular-reference-problem-in-SAS/m-p/590544#M15068</guid>
      <dc:creator>ubshams</dc:creator>
      <dc:date>2019-09-20T20:09:02Z</dc:date>
    </item>
  </channel>
</rss>

