<?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 create dynamic / moving reference in macro? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-dynamic-moving-reference-in-macro/m-p/203838#M267019</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Really appreciate for the input. &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Since forecasted spend has to be based on actual spend. The line &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: calibri, verdana, arial, sans-serif; font-size: 13px; background-color: #ffffff;"&gt;spend (i ) = spend (i-1) / shape_factor (i-1) * shape_factor( i ) &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt; will let spend(i) depend on spend(i-1) which further depends on spend(i-2). &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Therefore, I modified your suggested code by differentiating forecast spend and actual spend below. But again, since haven't assign actual spend data into an array, SAS will assume spend(i-1) is an undeclared function of i, per &lt;/SPAN&gt;&lt;STRONG style="font-size: 11.6999998092651px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;A _jive_internal="true" class="jiveTT-hover-user jive-username-link" data-avatarid="2333" data-externalid="" data-presence="null" data-userid="260198" data-username="ballardw" href="https://communities.sas.com/people/ballardw" id="jive-26019849521528281215186" style="padding: 0 3px 0 0; font-weight: inherit; font-style: inherit; font-size: 1.1em; font-family: inherit; color: #0e66ba;"&gt;ballardw&lt;/A&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;pointed out earlier.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Plus, assigning shape factors this way might not be realistic dealing with thousands of segments/shapes later on. Thanks for the code though, I am piecing info from the forum and my research together and am sure will find the answer eventually/hopefully.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif;"&gt;%let count=60;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif;"&gt;data output;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif;"&gt;set input;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif;"&gt;array forecast_spend (60);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif;"&gt;array shape_factor(24) _temporary_ (&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt; 0.2 0.56 0.65 0.73 0.80 0.86 0.91 0.95 0.98 1.00 1.02 1.04 1.06 1.08 1.10 1.11 1.12 1.13 1.14 1.15 1.16 1.17 1.18 1.19);&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif;"&gt;do i = months_since_opened to &amp;amp;count;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif; color: #0000ff;"&gt;forecast_spend (i ) = spend (i-1) / shape_factor (i-1) * shape_factor( i )&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif; color: #333333;"&gt;&lt;EM style="font-weight: inherit; font-family: inherit;"&gt;end;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;EM style="font-family: calibri, verdana, arial, sans-serif; font-weight: inherit;"&gt;Log: The function spend is unknown, or cannot be accessed.&lt;/EM&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 12 Jun 2015 20:48:24 GMT</pubDate>
    <dc:creator>stlimpbizkit</dc:creator>
    <dc:date>2015-06-12T20:48:24Z</dc:date>
    <item>
      <title>How to create dynamic / moving reference in macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-dynamic-moving-reference-in-macro/m-p/203820#M267001</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;Hello SAS community friends,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;Previously I asked about Call SYMPUT function and whether it can assign values to macro variable for each record based on existing data field and retain that value for data step before moving on to the next record. The new question is similar and yet different, using a similar example below for demonstrative purpose. If you are interested, feel free to check out the original question that is helped and answered by the community: &lt;A _jive_internal="true" class="active_link" href="https://communities.sas.com/message/277182#277182"&gt;https://communities.sas.com/message/277182#277182&lt;/A&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;A bit of context - I have a list of accounts that were opened at various point in time and hence with different performance length, measured by field "month_since_opened". The performance I am measuring is spend. Based on the available data points, I am to forecast the future spend and extrapolate the spend curve based on a known shape, represented by a series of shape factors (not shown in example for simplicity).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 1360px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl65" height="17" style="text-align: center;" width="136"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;Acct_No&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none;" width="136"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;Month_since_opened&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none;" width="136"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;Spend_month_1&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none;" width="136"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;Spend_month_2&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none;" width="136"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;Spend_month_3&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none;" width="136"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;Spend_month_4&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none;" width="136"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;Spend_month_5&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none;" width="136"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;Spend_month_6&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none;" width="136"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;Spend_month_7&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none;" width="136"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;…&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17" style="text-align: center; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;1&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;5&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;500&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;450&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;600&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;520&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;250&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;…&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;…&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;…&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17" style="text-align: center; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;2&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;5&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;0&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;300&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;250&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;300&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;250&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;…&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;…&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;…&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17" style="text-align: center; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;3&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;4&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;150&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;350&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;250&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;200&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;.&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;…&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;…&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;…&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17" style="text-align: center; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;4&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;3&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;600&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;510&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;460&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;.&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;.&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;…&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;…&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;…&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17" style="text-align: center; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;5&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;2&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;500&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;450&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;.&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;.&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;.&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;…&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;…&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none; border-top: medium none;"&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;…&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;My &lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;challenge&lt;/STRONG&gt;&lt;/SPAN&gt; is to create a moving reference to produce forecast based on spend data from the trailing month, or last available month for each account to be exact. I haven't been able to write the statement correctly (in &lt;SPAN style="color: #0000ff;"&gt;blue&lt;/SPAN&gt; below).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;%let count=60;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;EM&gt;/*assume we need to forecast up to 5 years/ 60 months of performance*/&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;data output;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;set input;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;array spend (60);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;EM&gt;/*In my previous post, array function was recommended as a solution to create the shell*/&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;do i = months_since_opened to &amp;amp;count;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; color: #0000ff;"&gt;spend (i ) = spend (i-1) / shape factor (i-1) * shape factor i&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #333333;"&gt;&amp;nbsp; &lt;EM&gt;/* simplified algorithm: divided spend from month i-1 by shape factor i-1 to get "normalized" spend value , then apply shape factor at month i to forecast spend at month i; shape factors are existing field by month similar to spend_month_n*/&lt;/EM&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;EM&gt;end;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;Hope the way question is explained makes sense, and thanks in advance for any hint/ideas you might be able to share with me!&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 17:45:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-dynamic-moving-reference-in-macro/m-p/203820#M267001</guid>
      <dc:creator>stlimpbizkit</dc:creator>
      <dc:date>2015-06-11T17:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to create dynamic / moving reference in macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-dynamic-moving-reference-in-macro/m-p/203821#M267002</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is the "data" shown the input or the output?&lt;/P&gt;&lt;P&gt;The pseudo-code you show references&amp;nbsp; a shape factor array, you need to declare and populate that at least.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 17:57:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-dynamic-moving-reference-in-macro/m-p/203821#M267002</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-06-11T17:57:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to create dynamic / moving reference in macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-dynamic-moving-reference-in-macro/m-p/203822#M267003</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the feedback. That was valid point. I have updated the original content to: 1). reflect the correct input / output dataset; 2) add note that shape factors are a series of existing fields by month&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 18:11:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-dynamic-moving-reference-in-macro/m-p/203822#M267003</guid>
      <dc:creator>stlimpbizkit</dc:creator>
      <dc:date>2015-06-11T18:11:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to create dynamic / moving reference in macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-dynamic-moving-reference-in-macro/m-p/203823#M267004</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One piece of the puzzle:&amp;nbsp; Your code is going to replace the Spend variables with new values.&amp;nbsp; Instead, create a second set of variables to hold the forecasts.&amp;nbsp; Once you do that, the need for macro language likely disappears.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;array forecast {60} forecast1-forecast60;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; color: #0000ff;"&gt;forecast (i ) = spend (i-1) / shape factor (i-1) * shape factor i&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;You may not utilize forecast1, but it's easier to leave it in the program.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 19:27:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-dynamic-moving-reference-in-macro/m-p/203823#M267004</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-06-11T19:27:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to create dynamic / moving reference in macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-dynamic-moving-reference-in-macro/m-p/203824#M267005</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for continuing to help with this case after pointing me to the right direction in part 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I actually did what you suggested - creating new series of fields "forecasted_spend_month_n". (Stitching actual and forecasted spend together into one string for further analysis will be another thing I need to figure out at a later point &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;). In this post, my challenge relies within the code.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; color: #0000ff;"&gt;forecast (i ) = spend (i-1) / shape factor (i-1) * shape factor i ,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;this formula is somewhat conceptual to capture the intent. I was not able to write out the code that works, as in - When I uses "spend (i-1)" in the code, SAS wouldn't understand it is the trailing month spend that I am referring to. I tried introducing a second variable j = i-1 so that I can use j instead of i-1, but that hasn't been successful for me either.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The crux of my issue here is that (i ) and (i-1) are part of field name, and I am looking for ways to be able to refer to them in my formula respectively.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 20:59:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-dynamic-moving-reference-in-macro/m-p/203824#M267005</guid>
      <dc:creator>stlimpbizkit</dc:creator>
      <dc:date>2015-06-11T20:59:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to create dynamic / moving reference in macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-dynamic-moving-reference-in-macro/m-p/203825#M267006</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's a little hard to see what you have actually done, but SAS definitely understands that spend(i-1) refers to the previous month.&amp;nbsp; The only time you would run into trouble with that is when i=1 and there is no previous month.&amp;nbsp; The error message would say something like "Array subscript out of range."&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 21:07:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-dynamic-moving-reference-in-macro/m-p/203825#M267006</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-06-11T21:07:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to create dynamic / moving reference in macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-dynamic-moving-reference-in-macro/m-p/203826#M267007</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This really looks like you want an array for the shape factor values.&lt;BR /&gt;You would need to make sure the array name doesn't have spaces and the final reference would need to be shape_factor (i).&lt;/P&gt;&lt;P&gt;Getting the index variables to start and end as needed is a common issue with array processing.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 21:54:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-dynamic-moving-reference-in-macro/m-p/203826#M267007</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-06-11T21:54:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to create dynamic / moving reference in macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-dynamic-moving-reference-in-macro/m-p/203827#M267008</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you considering transforming your data to a normalized structure - a row per month and using lag functions instead?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 22:19:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-dynamic-moving-reference-in-macro/m-p/203827#M267008</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-06-11T22:19:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to create dynamic / moving reference in macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-dynamic-moving-reference-in-macro/m-p/203828#M267009</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the idea Reeza. The raw dataset was structured that way - one month per record and multiple records/months per account, which then was transposed to a horizontal structure so that forecast/extrapolation is easier by creating new columns.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jun 2015 13:11:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-dynamic-moving-reference-in-macro/m-p/203828#M267009</guid>
      <dc:creator>stlimpbizkit</dc:creator>
      <dc:date>2015-06-12T13:11:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to create dynamic / moving reference in macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-dynamic-moving-reference-in-macro/m-p/203829#M267010</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried referring to the trailing month spend by using "spend(i-1)" or "spend(&amp;amp;i-1)", and got error message saying "The function SPEND is unknown, or cannot be accessed", which leads me to believe that SAS does not recognize "spend" as part of field name if I add any calculation upon i.. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jun 2015 19:13:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-dynamic-moving-reference-in-macro/m-p/203829#M267010</guid>
      <dc:creator>stlimpbizkit</dc:creator>
      <dc:date>2015-06-12T19:13:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to create dynamic / moving reference in macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-dynamic-moving-reference-in-macro/m-p/203830#M267011</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you created an array of variables named spend? If not then SAS has to guess what "spend" is and the way you are using it makes SAS think it might be a function.&lt;/P&gt;&lt;P&gt;Time to show the actual code you are attempting to run.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jun 2015 19:20:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-dynamic-moving-reference-in-macro/m-p/203830#M267011</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-06-12T19:20:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to create dynamic / moving reference in macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-dynamic-moving-reference-in-macro/m-p/203831#M267012</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks that makes sense. I haven't created an array named spend and hence the error message. Spend data are in the form of available columns from existing dataset, and so is shape:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI&gt;spend data - as the example shown in the post (actual dataset has more records and more months of spend performance. Also there is segment field that I used to append shape later on)&lt;/LI&gt;&lt;LI&gt;shape data - has columns for shape factors by month up to 60 months that is to be covered.&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Next, I merged spend data with shape data by segment. The merged dataset is the input dataset for the question posted. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif;"&gt;%let count=60;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif;"&gt;data output;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif;"&gt;set input;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif;"&gt;array spend (60);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif;"&gt;do i = months_since_opened to &amp;amp;count;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif; color: #0000ff;"&gt;spend (i ) = spend (i-1) / shape factor (i-1) * shape factor i&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif; color: #333333;"&gt;&lt;EM style="font-weight: inherit; font-family: inherit;"&gt;end;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;By the way I wasn't trying to hide my code since I am the one looking for suggestions.&amp;nbsp; :smileycool:&amp;nbsp; Just trying to simplify the case without losing necessary info. Besides what I have pasted here, the rest are a few data steps to prepare the input as described above.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jun 2015 19:43:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-dynamic-moving-reference-in-macro/m-p/203831#M267012</guid>
      <dc:creator>stlimpbizkit</dc:creator>
      <dc:date>2015-06-12T19:43:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to create dynamic / moving reference in macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-dynamic-moving-reference-in-macro/m-p/203832#M267013</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Where's the declaration for the shape array? If I understand correctly its in a separate dataset so need to merge it in somehow as well. If its a set of constants I'd consider a temporary array.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jun 2015 19:51:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-dynamic-moving-reference-in-macro/m-p/203832#M267013</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-06-12T19:51:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to create dynamic / moving reference in macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-dynamic-moving-reference-in-macro/m-p/203833#M267014</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For shape, I am actually working with dummy numbers right now to sort out the SAS code first. To come up with the right shape by segment, that is a separate piece of valuation analysis by itself. To be further transparent, I created the dummy shape like this (literally "dummy" method):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA SHAPE;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; INPUT NAME $ shape1 &lt;SPAN style="font-size: 13.3333330154419px;"&gt;shape&lt;/SPAN&gt;2 &lt;SPAN style="font-size: 13.3333330154419px;"&gt;shape&lt;/SPAN&gt;3 &lt;SPAN style="font-size: 13.3333330154419px;"&gt;shape&lt;/SPAN&gt;4 &lt;SPAN style="font-size: 13.3333330154419px;"&gt;shape&lt;/SPAN&gt;5 &lt;SPAN style="font-size: 13.3333330154419px;"&gt;shape&lt;/SPAN&gt;6 &lt;SPAN style="font-size: 13.3333330154419px;"&gt;shape&lt;/SPAN&gt;7 &lt;SPAN style="font-size: 13.3333330154419px;"&gt;shape&lt;/SPAN&gt;8 &lt;SPAN style="font-size: 13.3333330154419px;"&gt;shape&lt;/SPAN&gt;9 &lt;SPAN style="font-size: 13.3333330154419px;"&gt;shape&lt;/SPAN&gt;10 &lt;SPAN style="font-size: 13.3333330154419px;"&gt;shape&lt;/SPAN&gt;11 &lt;SPAN style="font-size: 13.3333330154419px;"&gt;shape&lt;/SPAN&gt;12 &lt;SPAN style="font-size: 13.3333330154419px;"&gt;shape&lt;/SPAN&gt;13 &lt;SPAN style="font-size: 13.3333330154419px;"&gt;shape&lt;/SPAN&gt;14 &lt;SPAN style="font-size: 13.3333330154419px;"&gt;shape&lt;/SPAN&gt;15 &lt;SPAN style="font-size: 13.3333330154419px;"&gt;shape&lt;/SPAN&gt;16 &lt;SPAN style="font-size: 13.3333330154419px;"&gt;shape&lt;/SPAN&gt;17 &lt;SPAN style="font-size: 13.3333330154419px;"&gt;shape&lt;/SPAN&gt;18 &lt;SPAN style="font-size: 13.3333330154419px;"&gt;shape&lt;/SPAN&gt;19 &lt;SPAN style="font-size: 13.3333330154419px;"&gt;shape&lt;/SPAN&gt;20 &lt;SPAN style="font-size: 13.3333330154419px;"&gt;shape&lt;/SPAN&gt;21 &lt;SPAN style="font-size: 13.3333330154419px;"&gt;shape&lt;/SPAN&gt;22 &lt;SPAN style="font-size: 13.3333330154419px;"&gt;shape&lt;/SPAN&gt;23 &lt;SPAN style="font-size: 13.3333330154419px;"&gt;shape&lt;/SPAN&gt;24;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; DATALINES;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; spend_shape&amp;nbsp; 0.2 0.56 0.65 0.73 0.80 0.86 0.91 0.95 0.98 1.00 1.02 1.04 1.06 1.08 1.10 1.11 1.12 1.13 1.14 1.15 1.16 1.17 1.18 1.19&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jun 2015 20:01:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-dynamic-moving-reference-in-macro/m-p/203833#M267014</guid>
      <dc:creator>stlimpbizkit</dc:creator>
      <dc:date>2015-06-12T20:01:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to create dynamic / moving reference in macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-dynamic-moving-reference-in-macro/m-p/203834#M267015</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;And how are you planning to pass those values to the data step indicated in your previous code where you seen to be referring to a SHAPE array already?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jun 2015 20:02:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-dynamic-moving-reference-in-macro/m-p/203834#M267015</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-06-12T20:02:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to create dynamic / moving reference in macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-dynamic-moving-reference-in-macro/m-p/203835#M267016</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif;"&gt;Perhaps something like the following (untested):&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif;"&gt;%let count=60;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif;"&gt;data output;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif;"&gt;set input;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif;"&gt;array spend (60);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif;"&gt;array shape_factor(24) _temporary_ (&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt; 0.2 0.56 0.65 0.73 0.80 0.86 0.91 0.95 0.98 1.00 1.02 1.04 1.06 1.08 1.10 1.11 1.12 1.13 1.14 1.15 1.16 1.17 1.18 1.19);&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif;"&gt;do i = months_since_opened to &amp;amp;count;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif; color: #0000ff;"&gt;spend (i ) = spend (i-1) / shape_factor (i-1) * shape_factor( i )&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif; color: #333333;"&gt;&lt;EM style="font-weight: inherit; font-family: inherit;"&gt;end;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jun 2015 20:04:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-dynamic-moving-reference-in-macro/m-p/203835#M267016</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-06-12T20:04:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to create dynamic / moving reference in macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-dynamic-moving-reference-in-macro/m-p/203836#M267017</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Those shape values are stored in dataset "shape" which is merged with "spend" and combined into "input".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't have anything between &lt;SPAN style="text-decoration: underline;"&gt;merging shape &amp;amp; spend&lt;/SPAN&gt; and &lt;SPAN style="text-decoration: underline;"&gt;the piece of code with blue line above&lt;/SPAN&gt; . Maybe certain steps are needed before I can create the array with relative reference (much like offset function in excel)?&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jun 2015 20:12:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-dynamic-moving-reference-in-macro/m-p/203836#M267017</guid>
      <dc:creator>stlimpbizkit</dc:creator>
      <dc:date>2015-06-12T20:12:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to create dynamic / moving reference in macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-dynamic-moving-reference-in-macro/m-p/203837#M267018</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You still haven't declared the shape array then. And for the rest, I don't understand the problem anymore. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jun 2015 20:41:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-dynamic-moving-reference-in-macro/m-p/203837#M267018</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-06-12T20:41:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to create dynamic / moving reference in macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-dynamic-moving-reference-in-macro/m-p/203838#M267019</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Really appreciate for the input. &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Since forecasted spend has to be based on actual spend. The line &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: calibri, verdana, arial, sans-serif; font-size: 13px; background-color: #ffffff;"&gt;spend (i ) = spend (i-1) / shape_factor (i-1) * shape_factor( i ) &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt; will let spend(i) depend on spend(i-1) which further depends on spend(i-2). &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Therefore, I modified your suggested code by differentiating forecast spend and actual spend below. But again, since haven't assign actual spend data into an array, SAS will assume spend(i-1) is an undeclared function of i, per &lt;/SPAN&gt;&lt;STRONG style="font-size: 11.6999998092651px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;A _jive_internal="true" class="jiveTT-hover-user jive-username-link" data-avatarid="2333" data-externalid="" data-presence="null" data-userid="260198" data-username="ballardw" href="https://communities.sas.com/people/ballardw" id="jive-26019849521528281215186" style="padding: 0 3px 0 0; font-weight: inherit; font-style: inherit; font-size: 1.1em; font-family: inherit; color: #0e66ba;"&gt;ballardw&lt;/A&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;pointed out earlier.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Plus, assigning shape factors this way might not be realistic dealing with thousands of segments/shapes later on. Thanks for the code though, I am piecing info from the forum and my research together and am sure will find the answer eventually/hopefully.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif;"&gt;%let count=60;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif;"&gt;data output;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif;"&gt;set input;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif;"&gt;array forecast_spend (60);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif;"&gt;array shape_factor(24) _temporary_ (&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt; 0.2 0.56 0.65 0.73 0.80 0.86 0.91 0.95 0.98 1.00 1.02 1.04 1.06 1.08 1.10 1.11 1.12 1.13 1.14 1.15 1.16 1.17 1.18 1.19);&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif;"&gt;do i = months_since_opened to &amp;amp;count;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif; color: #0000ff;"&gt;forecast_spend (i ) = spend (i-1) / shape_factor (i-1) * shape_factor( i )&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif; color: #333333;"&gt;&lt;EM style="font-weight: inherit; font-family: inherit;"&gt;end;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;EM style="font-family: calibri, verdana, arial, sans-serif; font-weight: inherit;"&gt;Log: The function spend is unknown, or cannot be accessed.&lt;/EM&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jun 2015 20:48:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-dynamic-moving-reference-in-macro/m-p/203838#M267019</guid>
      <dc:creator>stlimpbizkit</dc:creator>
      <dc:date>2015-06-12T20:48:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to create dynamic / moving reference in macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-dynamic-moving-reference-in-macro/m-p/203839#M267020</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Assuming your data set INPUT has 60 variables named SPEND1 through SPEND60 then you need:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;array spend spend1 - spend60;&lt;/P&gt;&lt;P&gt;for the Spend(i-1) reference to work.&lt;/P&gt;&lt;P&gt;If the actual Spend variables in the input set are named something else they go in the place of the list where I show spend1 - spend60, ensuring the order matches the use you want. Note the - is a "from to" indicator, not subtraction.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jun 2015 20:59:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-dynamic-moving-reference-in-macro/m-p/203839#M267020</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-06-12T20:59:03Z</dc:date>
    </item>
  </channel>
</rss>

