<?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: There is a bug in the code in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/There-is-a-bug-in-the-code/m-p/456157#M4136</link>
    <description>&lt;P&gt;Sorry. I have no time to go through all these code.&lt;/P&gt;
&lt;P&gt;Since it is IML code, Maybe&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp;would give you some advice .&lt;/P&gt;</description>
    <pubDate>Sat, 21 Apr 2018 10:06:10 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2018-04-21T10:06:10Z</dc:date>
    <item>
      <title>There is a bug in the code</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/There-is-a-bug-in-the-code/m-p/455913#M4133</link>
      <description>&lt;P&gt;Dear SAS Users,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use the code below. What I am trying to do is to run sum equations simultaneously so that some of the observations (volatility, value of the firm) are determined simultaneously. For this, I employ the code below. However, what I get is that there is a bug that I am failing to identify. In particular, I receive the following mistake:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class="default prettyprint prettyprinted"&gt;&lt;CODE&gt;&lt;SPAN class="pln"&gt;matrix z has &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;not&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; been &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;set&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; to a value &lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;no&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; data &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;set&lt;/SPAN&gt; &lt;SPAN class="kwd"&gt;is&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; currently open &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;for&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; output&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="typ"&gt;File&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; WORK&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;MYDATA2&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;DATA does &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;not&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; exist&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;I attach code (main - SASnew) and a&amp;nbsp;data sample ('"sample" together with the&amp;nbsp;"Winsorize_Macro" - that I used as a macro for winsorization purposes). Please, advise me this issue.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jun 2018 10:53:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/There-is-a-bug-in-the-code/m-p/455913#M4133</guid>
      <dc:creator>Alberto_Alvarez</dc:creator>
      <dc:date>2018-06-14T10:53:16Z</dc:date>
    </item>
    <item>
      <title>Re: There is a bug in the code</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/There-is-a-bug-in-the-code/m-p/455917#M4134</link>
      <description>&lt;P&gt;If you want winsorized data . Here is the code I wrote before.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
 do i=1 to 100;
  a=ceil(ranuni(1)*100);
  b=ceil(ranuni(2)*100);
  output;
 end;
 drop i;
run;


%let low=0.05 ;
%let high=0.95 ;

proc iml;
use have;
read all var _num_ into x[c=vname];
close have;
call qntl(q,x,{&amp;amp;low ,&amp;amp;high});

do i=1 to ncol(x);
 x[loc(x[,i]&amp;lt;q[1,i]),i]=q[1,i];
 x[loc(x[,i]&amp;gt;q[2,i]),i]=q[2,i];
end;

create want from x[c=vname];
append from x;
close want;

quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 20 Apr 2018 14:00:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/There-is-a-bug-in-the-code/m-p/455917#M4134</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-04-20T14:00:50Z</dc:date>
    </item>
    <item>
      <title>Re: There is a bug in the code</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/There-is-a-bug-in-the-code/m-p/455919#M4135</link>
      <description>&lt;P&gt;Thank you very much! I will follow your code. However, the problem is in the main code (SASnew), that results in a bug stated above. Maybe you have an idea of how I can fix it.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Apr 2018 14:02:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/There-is-a-bug-in-the-code/m-p/455919#M4135</guid>
      <dc:creator>Alberto_Alvarez</dc:creator>
      <dc:date>2018-04-20T14:02:59Z</dc:date>
    </item>
    <item>
      <title>Re: There is a bug in the code</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/There-is-a-bug-in-the-code/m-p/456157#M4136</link>
      <description>&lt;P&gt;Sorry. I have no time to go through all these code.&lt;/P&gt;
&lt;P&gt;Since it is IML code, Maybe&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp;would give you some advice .&lt;/P&gt;</description>
      <pubDate>Sat, 21 Apr 2018 10:06:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/There-is-a-bug-in-the-code/m-p/456157#M4136</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-04-21T10:06:10Z</dc:date>
    </item>
    <item>
      <title>Re: There is a bug in the code</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/There-is-a-bug-in-the-code/m-p/456160#M4137</link>
      <description>&lt;P&gt;You need to examine more of the log, Is the call to QUAD failing? The error says that the z variable (the integral of "FUN" on the interval&amp;nbsp;ylow || yhigh&amp;nbsp;is not assigned a value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is how to resolve this issue. You need to extract the code that has the problem from all the other code.:&lt;/P&gt;
&lt;P&gt;1. Print the values of the TEST data set.&lt;/P&gt;
&lt;P&gt;2. In the PROC IML code, hard-code the values of the B vector. For example the start of the IML segment might become&lt;/P&gt;
&lt;P&gt;csho = 4.2; t_debt = 3.86; ...&amp;nbsp;ylow = 1.23];&amp;nbsp; /* values from TEST data */&lt;/P&gt;
&lt;P&gt;3. The PROC IML step can then be run independently and you can debug the issue.&lt;/P&gt;</description>
      <pubDate>Sat, 21 Apr 2018 10:43:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/There-is-a-bug-in-the-code/m-p/456160#M4137</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2018-04-21T10:43:02Z</dc:date>
    </item>
    <item>
      <title>Re: There is a bug in the code</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/There-is-a-bug-in-the-code/m-p/456209#M4138</link>
      <description>&lt;P&gt;By the way, although your problem has nothing to do with Winsorization, I would caution you to always verify that the code you are using to Winsorize data is correct. I have seen many&amp;nbsp;SAS programs that claim to Winsorize data, but many of them are wrong. The correct way to Winsorize data is explained in the article &lt;A href="https://blogs.sas.com/content/iml/2015/07/15/winsorize-data.html" target="_self"&gt;"How to Winsorize data in SAS,"&amp;nbsp;&lt;/A&gt;which includes an example. (If you have missing values in your data, be doubly wary!)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To verify whether&amp;nbsp;the code you are using correctly Winsorizes data, you can run the following check. The call to PROC UNIVARIATE computes the Winsorized means of the variables X1 and X2. The call to PROC MEANS computes the means of the Winsorized&amp;nbsp;data. If you do not get the same answers, then the code that Winsorized the data is&amp;nbsp;not correct.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Winsorized means of the original data */
proc univariate data=OrigData Winsor=0.05;
   var x1 x2;
   ods select WinsorizedMeans;
run;

/* means of the Winsorized data */
proc means data=WinsorizedData mean;
   var x1 x2;
run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I would also urge you to consider whether Winsorizing data is an appropriate way to handle extreme values in the data. Please read my article &lt;A href="https://blogs.sas.com/content/iml/2017/02/08/winsorization-good-bad-and-ugly.html" target="_self"&gt;"Winsorization: The good, the bad, and the ugly"&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 21 Apr 2018 17:29:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/There-is-a-bug-in-the-code/m-p/456209#M4138</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2018-04-21T17:29:50Z</dc:date>
    </item>
    <item>
      <title>Re: There is a bug in the code</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/There-is-a-bug-in-the-code/m-p/456816#M4146</link>
      <description>&lt;P&gt;I looked at this further. Instead of focusing on the integral, you need to focus on the function (the integrand) first. You are attempting to integrate a function that is essentially zero (numerically)&amp;nbsp;on its domain. The following statements evaluate the function at the min, mid, and max values of the domain. The function returns zero for each location. If you try to plot the function, you will discover that it&amp;nbsp;evaluates to zero on a uniform grid of points on its domain.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;x1 = fun(ylow);
x2 = fun(mid); 
x3 = fun(yhigh);
print x1 x2 x3;    /* prints 0 0 0 */

tt = do(yhigh, ylow, (ylow-yhigh)/200);
yy = j(1, ncol(tt), .);
do i = 1 to ncol(tt);
   yy[i] = fun(tt[i]);
end;
print (range(yy));   /* prints 0 */
call series(tt, yy); /* shows straight line at y=0 */
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 Apr 2018 10:14:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/There-is-a-bug-in-the-code/m-p/456816#M4146</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2018-04-24T10:14:28Z</dc:date>
    </item>
    <item>
      <title>Re: There is a bug in the code</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/There-is-a-bug-in-the-code/m-p/456962#M4148</link>
      <description>&lt;P&gt;Thank you very much for your help. The main problem that I face is the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Convergence could not be attained over the subinterval&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Can you advise me on this issue?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Apr 2018 17:09:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/There-is-a-bug-in-the-code/m-p/456962#M4148</guid>
      <dc:creator>Alberto_Alvarez</dc:creator>
      <dc:date>2018-04-24T17:09:37Z</dc:date>
    </item>
    <item>
      <title>Re: There is a bug in the code</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/There-is-a-bug-in-the-code/m-p/456974#M4149</link>
      <description>&lt;P&gt;Yes. I have given you two pieces of advice:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Isolate the problem into a single, self-contained IML program.&lt;/P&gt;
&lt;P&gt;2. Debug and visualize the integrand first before you worry about the integrand.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you have done these two things, the problem should be apparent. If not, post the reduced and simplified&amp;nbsp;example.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Apr 2018 17:23:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/There-is-a-bug-in-the-code/m-p/456974#M4149</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2018-04-24T17:23:32Z</dc:date>
    </item>
  </channel>
</rss>

