<?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: Recursiveness in SAS in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Recursiveness-in-SAS/m-p/637968#M21507</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input A	B	;
cards;
11	6	6
2	27	27
7	12	12
8	.	96
3	.	288
4	.	1152
;

data &lt;SPAN&gt;w&lt;/SPAN&gt;ant;
 set have;
 retain c;
 if b then c=b;
 else c=c*a;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 07 Apr 2020 00:17:03 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2020-04-07T00:17:03Z</dc:date>
    <item>
      <title>Recursiveness in SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Recursiveness-in-SAS/m-p/637965#M21506</link>
      <description>&lt;P&gt;&lt;FONT&gt;I'd like to write a code that would do a recursive multiplication in one column.&lt;BR /&gt;I have columns A and B and the idea is to calculate the column C as follows:&lt;BR /&gt;When B is different from empty, then B=C.&lt;BR /&gt;When B is empty, then the value for the line "i" of C is the value for the line "i" of A times the value for line (i-1) of C, as in the example below:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;27&lt;/TD&gt;&lt;TD&gt;27&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;7&lt;/TD&gt;&lt;TD&gt;12&lt;/TD&gt;&lt;TD&gt;12&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;96&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;288&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;1152&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Tue, 07 Apr 2020 00:04:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Recursiveness-in-SAS/m-p/637965#M21506</guid>
      <dc:creator>usuario_estudo</dc:creator>
      <dc:date>2020-04-07T00:04:16Z</dc:date>
    </item>
    <item>
      <title>Re: Recursiveness in SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Recursiveness-in-SAS/m-p/637968#M21507</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input A	B	;
cards;
11	6	6
2	27	27
7	12	12
8	.	96
3	.	288
4	.	1152
;

data &lt;SPAN&gt;w&lt;/SPAN&gt;ant;
 set have;
 retain c;
 if b then c=b;
 else c=c*a;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Apr 2020 00:17:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Recursiveness-in-SAS/m-p/637968#M21507</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-04-07T00:17:03Z</dc:date>
    </item>
    <item>
      <title>Re: Recursiveness in SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Recursiveness-in-SAS/m-p/637976#M21511</link>
      <description>&lt;P&gt;That is not a recursive problem.&lt;/P&gt;
&lt;P&gt;Assuming that you meant to set C to the value of B and not the other way around (since the other way around wouldn't produce your expected values).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data expect;
  input A B expect;
cards;
11 6 6
2 27 27
7 12 12
8 . 96
3 . 288
4 . 1152
;
data want;
  set expect ;
  retain c;
  if not missing(b) then c=b;
  else c=a*c;
run;
proc print;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;Obs     A     B    expect       c

 1     11     6        6        6
 2      2    27       27       27
 3      7    12       12       12
 4      8     .       96       96
 5      3     .      288      288
 6      4     .     1152     1152&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Apr 2020 01:37:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Recursiveness-in-SAS/m-p/637976#M21511</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-04-07T01:37:45Z</dc:date>
    </item>
  </channel>
</rss>

