<?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: small optimization problem in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/small-optimization-problem/m-p/439253#M109593</link>
    <description>&lt;P&gt;What exactly are you trying to optimize?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you be a bit more specific in your explanation?&lt;/P&gt;</description>
    <pubDate>Thu, 22 Feb 2018 12:44:24 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2018-02-22T12:44:24Z</dc:date>
    <item>
      <title>small optimization problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/small-optimization-problem/m-p/439245#M109588</link>
      <description>&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;Hello&lt;/SPAN&gt;&lt;BR /&gt;I have a small optimization problem.&lt;BR /&gt;I have two series of data and I would like to optimize the differences between them.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;I could use a loop but I know that sas has optimizing functions but I do not know it.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;Maybe someone will help me.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;The problem looks as follows.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input n $ x $ y;
datalines;
1	1	1
2	0.534825871	0.390243902
3	0.667910448	0.609756098
4	0.140547264	0.048780488
5	0.237562189	0.195121951
6	0	0
7	0.630597015	0.048780488

;
run;

data test;
set test;
z = abs(x - y);
sum_z = ( z + lag1(z) + lag2(z) + lag3(z) + lag4(z) + lag5(z) + lag6(z) );
run;

data test;
set test;
z1 = abs(x - (y + 0.01));
sum_z1 = ( z1 + lag1(z1) + lag2(z1) + lag3(z1) + lag4(z1) + lag5(z1) + lag6(z1) );
run;

data test;
set test;
z2 = abs(x - (y + 0.02));
sum_z2 = ( z2 + lag1(z2) + lag2(z2) + lag3(z2) + lag4(z2) + lag5(z2) + lag6(z2) );
run;&lt;BR /&gt;
/*******
********
*******/&lt;BR /&gt;
data test;
set test;
z6 = abs(x - (y + 0.06));
sum_z6 = ( z6 + lag1(z6) + lag2(z6) + lag3(z6) + lag4(z6) + lag5(z6) + lag6(z6) );
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class="short_text"&gt;Thank you for your help&lt;/SPAN&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;&lt;SPAN class=""&gt;&lt;SPAN class="short_text"&gt;optimize the differences between x and y -&amp;gt; the differences are presented (example) in the variable sum_z to sum_z6&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2018 12:54:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/small-optimization-problem/m-p/439245#M109588</guid>
      <dc:creator>makset7</dc:creator>
      <dc:date>2018-02-22T12:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: small optimization problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/small-optimization-problem/m-p/439253#M109593</link>
      <description>&lt;P&gt;What exactly are you trying to optimize?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you be a bit more specific in your explanation?&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2018 12:44:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/small-optimization-problem/m-p/439253#M109593</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-02-22T12:44:24Z</dc:date>
    </item>
  </channel>
</rss>

