<?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: get a value after minimizing sum of squares in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/get-a-value-after-minimizing-sum-of-squares/m-p/768161#M3510</link>
    <description>&lt;P&gt;Looks correct to me.&amp;nbsp; I have only two suggestions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Change the second READ DATA statement as follows:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;read data have2 into [bucket] z;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The index set B has already been populated from the previous READ DATA statement, and z=z is redundant.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. Use the INIT option to initialize c, as requested by the user:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;   var c init 1;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 16 Sep 2021 16:04:32 GMT</pubDate>
    <dc:creator>RobPratt</dc:creator>
    <dc:date>2021-09-16T16:04:32Z</dc:date>
    <item>
      <title>get a value after minimizing sum of squares</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/get-a-value-after-minimizing-sum-of-squares/m-p/768094#M3507</link>
      <description>&lt;P&gt;data have1;&lt;/P&gt;&lt;P&gt;input bucket$&amp;nbsp; probability ;&lt;BR /&gt;cards;&lt;BR /&gt;first&amp;nbsp; 0.0025&lt;BR /&gt;second&amp;nbsp; 0.37&lt;BR /&gt;third&amp;nbsp; 0.53&lt;BR /&gt;fourth&amp;nbsp; 0.89&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data have2;&lt;/P&gt;&lt;P&gt;input bucket$&amp;nbsp; z;&lt;BR /&gt;cards;&lt;BR /&gt;first -2.81&lt;BR /&gt;second -0.60&lt;BR /&gt;third -0.15&lt;BR /&gt;fourth 0.69&lt;/P&gt;&lt;P&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;I have 2 data sets as above. I want to calculate a value(v) as&lt;/P&gt;&lt;P&gt;v = cdf('normal', z+c)&lt;/P&gt;&lt;P&gt;where z = z-value from table have2&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; c = constant which we will start with 1 and continuously changing it to get the minimum sum of squares difference of V and probability( from table have1).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We are interested in getting the value of C (initially equals 1) such that (V - probability)^2 is minimised.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Sep 2021 12:03:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/get-a-value-after-minimizing-sum-of-squares/m-p/768094#M3507</guid>
      <dc:creator>Decay2020</dc:creator>
      <dc:date>2021-09-16T12:03:04Z</dc:date>
    </item>
    <item>
      <title>Re: get a value after minimizing sum of squares</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/get-a-value-after-minimizing-sum-of-squares/m-p/768130#M3508</link>
      <description>&lt;P&gt;If you have SAS/OR ,could try the following code . or calling&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/1636"&gt;@RobPratt&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or if you have SAS/IML ,could try many optimize function like CALL NLPNRA () ,CALL&amp;nbsp;NLPLM() .&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp; wrote may blogs about it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have1;
input bucket$  probability ;
cards;
first  0.0025
second  0.37
third  0.53
fourth  0.89
;
run;

 

data have2;
input bucket$  z;
cards;
first -2.81
second -0.60
third -0.15
fourth 0.69

;
run;

proc optmodel;
set &amp;lt;str&amp;gt; B;
num p{B} ;
num z{B};
read data have1 into B=[bucket] p=probability;
read data have2 into B=[bucket] z=z;

var c ;

min min=sum{i in B} (cdf('normal', z[i]+c)-p[i])**2;
solve ;

print c.sol;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1631799118342.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/63664i64F53DB64EE270E6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1631799118342.png" alt="Ksharp_0-1631799118342.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Sep 2021 13:32:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/get-a-value-after-minimizing-sum-of-squares/m-p/768130#M3508</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-09-16T13:32:07Z</dc:date>
    </item>
    <item>
      <title>Re: get a value after minimizing sum of squares</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/get-a-value-after-minimizing-sum-of-squares/m-p/768135#M3509</link>
      <description>Hi, Thank you for your quick response. I don't have the mentioned components. Can we use SAS/STAT in this. Or is there any other other way without using SAS/OR and SAS/IML. Thanks.</description>
      <pubDate>Thu, 16 Sep 2021 13:49:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/get-a-value-after-minimizing-sum-of-squares/m-p/768135#M3509</guid>
      <dc:creator>Decay2020</dc:creator>
      <dc:date>2021-09-16T13:49:25Z</dc:date>
    </item>
    <item>
      <title>Re: get a value after minimizing sum of squares</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/get-a-value-after-minimizing-sum-of-squares/m-p/768161#M3510</link>
      <description>&lt;P&gt;Looks correct to me.&amp;nbsp; I have only two suggestions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Change the second READ DATA statement as follows:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;read data have2 into [bucket] z;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The index set B has already been populated from the previous READ DATA statement, and z=z is redundant.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. Use the INIT option to initialize c, as requested by the user:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;   var c init 1;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 16 Sep 2021 16:04:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/get-a-value-after-minimizing-sum-of-squares/m-p/768161#M3510</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2021-09-16T16:04:32Z</dc:date>
    </item>
    <item>
      <title>Re: get a value after minimizing sum of squares</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/get-a-value-after-minimizing-sum-of-squares/m-p/768221#M3511</link>
      <description>Hi RobPratt,&lt;BR /&gt;Can we do this without using SAS/OR and SAS/IML? I don't have the required components as of now.&lt;BR /&gt;Can we use SAS/STAT in any way for this?&lt;BR /&gt;</description>
      <pubDate>Fri, 17 Sep 2021 04:15:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/get-a-value-after-minimizing-sum-of-squares/m-p/768221#M3511</guid>
      <dc:creator>Decay2020</dc:creator>
      <dc:date>2021-09-17T04:15:51Z</dc:date>
    </item>
    <item>
      <title>Re: get a value after minimizing sum of squares</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/get-a-value-after-minimizing-sum-of-squares/m-p/768262#M3512</link>
      <description>&lt;P&gt;OK. Here is. The same result with SAS/OR .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have1;
input bucket$  probability ;
cards;
first  0.0025
second  0.37
third  0.53
fourth  0.89
;
run;
proc sort data=have1;by bucket;run;

data have2;
input bucket$  z;
cards;
first -2.81
second -0.60
third -0.15
fourth 0.69

;
run;
proc sort data=have2;by bucket;run;

data want;
 merge have1 have2;
 by bucket;
run;

proc nlin data=want;
parms c 1;
mean=cdf('normal', z+c);

model probability=mean;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 17 Sep 2021 11:40:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/get-a-value-after-minimizing-sum-of-squares/m-p/768262#M3512</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-09-17T11:40:47Z</dc:date>
    </item>
  </channel>
</rss>

