<?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: Product function in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Product-function/m-p/730048#M227282</link>
    <description>Hi.&lt;BR /&gt;Thanks a lot to both for your very quick answers. Both solutions work perfectly and solve my problem.&lt;BR /&gt;Best regards.</description>
    <pubDate>Tue, 30 Mar 2021 10:37:08 GMT</pubDate>
    <dc:creator>Jorge_Silva</dc:creator>
    <dc:date>2021-03-30T10:37:08Z</dc:date>
    <item>
      <title>Product function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Product-function/m-p/729746#M227165</link>
      <description>&lt;P&gt;Hello.&lt;/P&gt;&lt;P&gt;I'm trying to replicate the sample data below in Excel (Period + Have) to SAS, trying to calculate the product between periods (for period 1 = have1; for period 2 = have 1*have2; for period 3 = have1*have2*have3; etc.) or&amp;nbsp;alternatively multiply the current period by the previous period (for period 1 = have1; for period 2 = have2*Or1; for period 3 = have 3*Or2; etc).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've already tried with loops or with the product workaround available but I'm not getting the results I desire.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there someone who can help me please?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Excel Sample:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Period&lt;/TD&gt;&lt;TD&gt;Have&lt;/TD&gt;&lt;TD&gt;Want&lt;/TD&gt;&lt;TD&gt;Excel Formula&lt;/TD&gt;&lt;TD&gt;Or&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Excel Formula&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0,98373490&lt;/TD&gt;&lt;TD&gt;0,98373490&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;0,98373490&lt;/TD&gt;&lt;TD&gt;=+B2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;0,95077541&lt;/TD&gt;&lt;TD&gt;0,93531096&lt;/TD&gt;&lt;TD&gt;=PRODUCT(B$2:B3)&lt;/TD&gt;&lt;TD&gt;0,93531096&lt;/TD&gt;&lt;TD&gt;=+B3*E2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;0,92290404&lt;/TD&gt;&lt;TD&gt;0,86320226&lt;/TD&gt;&lt;TD&gt;=PRODUCT(B$2:B4)&lt;/TD&gt;&lt;TD&gt;0,86320226&lt;/TD&gt;&lt;TD&gt;=+B4*E3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;0,93952522&lt;/TD&gt;&lt;TD&gt;0,81100029&lt;/TD&gt;&lt;TD&gt;=PRODUCT(B$2:B5)&lt;/TD&gt;&lt;TD&gt;0,81100029&lt;/TD&gt;&lt;TD&gt;=+B5*E4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;0,96857611&lt;/TD&gt;&lt;TD&gt;0,78551551&lt;/TD&gt;&lt;TD&gt;=PRODUCT(B$2:B6)&lt;/TD&gt;&lt;TD&gt;0,78551551&lt;/TD&gt;&lt;TD&gt;=+B6*E5&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Mon, 29 Mar 2021 10:31:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Product-function/m-p/729746#M227165</guid>
      <dc:creator>Jorge_Silva</dc:creator>
      <dc:date>2021-03-29T10:31:23Z</dc:date>
    </item>
    <item>
      <title>Re: Product function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Product-function/m-p/729753#M227166</link>
      <description>&lt;P&gt;If I understand the problem correctly, SAS does this pretty easily:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data new;
   set old (keep=period have);
   retain want 1;
   want = want * have;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;When moving from Excel to SAS, you need to get used to the idea that SAS is processing a single row at a time.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Mar 2021 12:56:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Product-function/m-p/729753#M227166</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2021-03-29T12:56:12Z</dc:date>
    </item>
    <item>
      <title>Re: Product function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Product-function/m-p/729754#M227167</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
retain want;
if _n_ = 1
then want = have;
else want = want * have;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Mar 2021 11:32:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Product-function/m-p/729754#M227167</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-03-29T11:32:13Z</dc:date>
    </item>
    <item>
      <title>Re: Product function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Product-function/m-p/730048#M227282</link>
      <description>Hi.&lt;BR /&gt;Thanks a lot to both for your very quick answers. Both solutions work perfectly and solve my problem.&lt;BR /&gt;Best regards.</description>
      <pubDate>Tue, 30 Mar 2021 10:37:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Product-function/m-p/730048#M227282</guid>
      <dc:creator>Jorge_Silva</dc:creator>
      <dc:date>2021-03-30T10:37:08Z</dc:date>
    </item>
    <item>
      <title>Re: Product function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Product-function/m-p/787453#M251614</link>
      <description>&lt;P&gt;I used PROC FCMP to implement a PRODUCT function. The implementation also handles missing values. See &lt;A href="https://blogs.sas.com/content/iml/2021/05/19/implement-product-function-sas.html" target="_self"&gt;"Implement a product function in SAS."&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Dec 2021 13:40:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Product-function/m-p/787453#M251614</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2021-12-27T13:40:32Z</dc:date>
    </item>
  </channel>
</rss>

