<?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: Calculate the Product of Variable Based on Date in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Calculate-the-Product-of-Variable-Based-on-Date/m-p/749261#M29562</link>
    <description>&lt;P&gt;A simple modification to the code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;growth=(RD12mG*lag11(RD12mG)*lag10(RD12mG)*lag9(RD12mG)*
/* I'm lazy, you type the rest */
-1)*100;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can also use PROC EXPAND, which would be less typing and more flexible.&lt;/P&gt;</description>
    <pubDate>Mon, 21 Jun 2021 14:14:07 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2021-06-21T14:14:07Z</dc:date>
    <item>
      <title>Calculate the Product of Variable Based on Date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Calculate-the-Product-of-Variable-Based-on-Date/m-p/749207#M29555</link>
      <description>&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new is SAS&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to replicate a product calculation in SAS but i am not sure how i can do it - see the attached pdf&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In short, I need to replicate column C using the formula (formula in the pdf) which calculates the 12 month growth rate&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then i need to populate all column C. For example, cell C16 needs to be =(PRODUCT(B5:B16)-1)*100, C17 to be =(PRODUCT(B6:B17)-1)*100 and so on&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help will be appreciated &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jun 2021 09:47:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Calculate-the-Product-of-Variable-Based-on-Date/m-p/749207#M29555</guid>
      <dc:creator>Toni2</dc:creator>
      <dc:date>2021-06-21T09:47:28Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate the Product of Variable Based on Date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Calculate-the-Product-of-Variable-Based-on-Date/m-p/749229#M29558</link>
      <description>&lt;P&gt;Some of us will not (or cannot) download attachments. You can show us (a portion of) your data and formula by including it in your reply. Data should be provided following &lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_self"&gt;these instructions&lt;/A&gt;. Formula can be included in your reply as a screen capture.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jun 2021 11:18:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Calculate-the-Product-of-Variable-Based-on-Date/m-p/749229#M29558</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-06-21T11:18:34Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate the Product of Variable Based on Date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Calculate-the-Product-of-Variable-Based-on-Date/m-p/749253#M29559</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the advises&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below you can see part of my dataset&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to create a new variable to calculate the 12 month growth in % for the RD12MG based on date&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Starting in 31JUL1983 in Excel the formula that I want to use is =((PRODUCT(G12:G23)-1)*100) where G12 = 1.011 and G23 = 1.008&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then, for example, for next dates the formula has to be :&amp;nbsp;&lt;/P&gt;&lt;P&gt;31AUG1983 the calculation has to be&amp;nbsp;=((PRODUCT(G13:G24)-1)*100)&amp;nbsp; where G13 = 1.008 and G24 = 1.003&lt;/P&gt;&lt;P&gt;30SEP1983 the calculation has to be&amp;nbsp;=((PRODUCT(G14:G25)-1)*100)&amp;nbsp; where G14 = 1.013 and G25 = 1.006&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;Obs Date RD12mG &lt;TABLE cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;31JUL1982&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;31AUG1982&lt;/TD&gt;&lt;TD&gt;1.011&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;30SEP1982&lt;/TD&gt;&lt;TD&gt;1.008&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;31OCT1982&lt;/TD&gt;&lt;TD&gt;1.013&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;30NOV1982&lt;/TD&gt;&lt;TD&gt;1.012&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;7&lt;/TD&gt;&lt;TD&gt;31DEC1982&lt;/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OV1983&lt;/TD&gt;&lt;TD&gt;1.011&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;19&lt;/TD&gt;&lt;TD&gt;31DEC1983&lt;/TD&gt;&lt;TD&gt;1.016&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;TD&gt;31JAN1984&lt;/TD&gt;&lt;TD&gt;1.004&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;21&lt;/TD&gt;&lt;TD&gt;29FEB1984&lt;/TD&gt;&lt;TD&gt;1.009&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;22&lt;/TD&gt;&lt;TD&gt;31MAR1984&lt;/TD&gt;&lt;TD&gt;1.012&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;23&lt;/TD&gt;&lt;TD&gt;30APR1984&lt;/TD&gt;&lt;TD&gt;1.013&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;24&lt;/TD&gt;&lt;TD&gt;31MAY1984&lt;/TD&gt;&lt;TD&gt;1.010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;25&lt;/TD&gt;&lt;TD&gt;30JUN1984&lt;/TD&gt;&lt;TD&gt;1.010&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jun 2021 12:56:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Calculate-the-Product-of-Variable-Based-on-Date/m-p/749253#M29559</guid>
      <dc:creator>Toni2</dc:creator>
      <dc:date>2021-06-21T12:56:40Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate the Product of Variable Based on Date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Calculate-the-Product-of-Variable-Based-on-Date/m-p/749254#M29560</link>
      <description>&lt;P&gt;Since these are months, there are no missing months, you can use the LAG11 function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    growth=(RD12mG*lag11(RD12mG)-1)*100;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 21 Jun 2021 13:14:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Calculate-the-Product-of-Variable-Based-on-Date/m-p/749254#M29560</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-06-21T13:14:58Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate the Product of Variable Based on Date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Calculate-the-Product-of-Variable-Based-on-Date/m-p/749259#M29561</link>
      <description>&lt;P&gt;thanks. I think that your formula multiples only the first and last value but we need all the values in the interval&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I mean for example, for 31JUL1983 the formula has to calculate growth as below :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;growth = (1.011 * 1.008 * 1.013 * 1.012 * 1.016 * 1.005 * 1.012 * 1.007 * 1.009 * 1.011 * 1.013 * 1.008) - 1)*100) = 13.3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea?&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jun 2021 13:57:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Calculate-the-Product-of-Variable-Based-on-Date/m-p/749259#M29561</guid>
      <dc:creator>Toni2</dc:creator>
      <dc:date>2021-06-21T13:57:41Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate the Product of Variable Based on Date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Calculate-the-Product-of-Variable-Based-on-Date/m-p/749261#M29562</link>
      <description>&lt;P&gt;A simple modification to the code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;growth=(RD12mG*lag11(RD12mG)*lag10(RD12mG)*lag9(RD12mG)*
/* I'm lazy, you type the rest */
-1)*100;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can also use PROC EXPAND, which would be less typing and more flexible.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jun 2021 14:14:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Calculate-the-Product-of-Variable-Based-on-Date/m-p/749261#M29562</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-06-21T14:14:07Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate the Product of Variable Based on Date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Calculate-the-Product-of-Variable-Based-on-Date/m-p/749262#M29563</link>
      <description>&lt;P&gt;yes, you are right, sorry!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for the support &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jun 2021 14:13:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Calculate-the-Product-of-Variable-Based-on-Date/m-p/749262#M29563</guid>
      <dc:creator>Toni2</dc:creator>
      <dc:date>2021-06-21T14:13:53Z</dc:date>
    </item>
  </channel>
</rss>

