<?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: ERROR: Cannot find a library containing subroutine RUN_MACRO. in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/ERROR-Cannot-find-a-library-containing-subroutine-RUN-MACRO/m-p/317906#M1565</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Thanks for the response.&lt;BR /&gt;&lt;BR /&gt;As I explained the proc fcmp is working well with proc optmodel on my&lt;BR /&gt;Windows PC but the error appears when I run it on UNIX server using&lt;BR /&gt;rsubmit. I believe the problem is not generated from proc optmodel but it's&lt;BR /&gt;only from the remote submit of proc fcmp since when I run the following&lt;BR /&gt;code I get the same error (ERROR: Cannot find a library containing&lt;BR /&gt;subroutine RUN_MACRO.).&lt;BR /&gt;&lt;BR /&gt;rsubmit ;&lt;BR /&gt;proc fcmp outlib=xwork.ds.functions;&lt;BR /&gt;&lt;BR /&gt;function Tot_profit(V5YC, F1YC, F2YC, F3YC, F4YC, F5YC,seg&lt;BR /&gt;$,peak,Num_comp_periods,Num_pay_period_year,Discount_rate,Free_Appr_cost,Amex_Point_Cost,cash_back_cost);&lt;BR /&gt;rc = run_macro('Profit',V5YC, F1YC, F2YC, F3YC, F4YC,&lt;BR /&gt;F5YC,seg,peak,Num_comp_periods,Num_pay_period_year,Discount_rate,Free_Appr_cost,Amex_Point_Cost,cash_back_cost,Sum_profit2,NII2,Vol2);&lt;BR /&gt;if rc eq 0 then return(Sum_profit2);&lt;BR /&gt;else return(.);&lt;BR /&gt;endsub;&lt;BR /&gt;&lt;BR /&gt;endrsubmit;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The reason that I'm using proc fcmp (called "Tot_profit") to create a&lt;BR /&gt;function which calls a macro function (called "Proft"). The Tot_profit&lt;BR /&gt;function is later called from proc optmodel to calculate the objective&lt;BR /&gt;function and the input arguments to that function is the optimization&lt;BR /&gt;variables and the outcome is the objective value which is supposed to be&lt;BR /&gt;maximized. If I just call the macro function directly from the proc&lt;BR /&gt;optmodel without utilizing the function created by proc fcmp then I get the&lt;BR /&gt;following error message for any line of code I add after calling the macro&lt;BR /&gt;function.&lt;BR /&gt;&lt;BR /&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;BR /&gt;&lt;BR /&gt;So please let me know your thoughts about the first error message from&lt;BR /&gt;remote submit of proc fcmp and also if you have any suggestion for calling&lt;BR /&gt;a macro function during optimization directly from proc optmodel without&lt;BR /&gt;utilizing proc fcmp.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Farshid&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;##- Please type your reply above this line. Simple formatting, no&lt;BR /&gt;attachments. -##</description>
    <pubDate>Fri, 09 Dec 2016 14:29:06 GMT</pubDate>
    <dc:creator>FrankB</dc:creator>
    <dc:date>2016-12-09T14:29:06Z</dc:date>
    <item>
      <title>ERROR: Cannot find a library containing subroutine RUN_MACRO.</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/ERROR-Cannot-find-a-library-containing-subroutine-RUN-MACRO/m-p/317655#M1563</link>
      <description>&lt;P&gt;I get the error message when I try to run the following sas code on SAS UNIX server but the code runs without any error on local windows computer. I was wondering if someone know the possible cause for this error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;rsubmit;&lt;BR /&gt;proc fcmp outlib=work.ds.functions;
  function Tot_profit(V5YC, ...);
    rc = run_macro('Profit',...);
    if rc eq 0 then return(Sum_profit2);
    else return(.);
   endsub;
run;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;options cmplib=work.ds;&lt;BR /&gt;proc optmodel;&lt;BR /&gt;&lt;BR /&gt; VAR V5YC init 1, F1YC init 1,F2YC init 0,F3YC init 3.20111035,F4YC init 3.20111035,F5YC init 3.20111035;&lt;BR /&gt; MAX Total_profit = Tot_profit( V5YC, ... );&lt;BR /&gt;&lt;BR /&gt; CON A: 3.29&amp;gt;= F3YC &amp;gt;= 2.89;&lt;BR /&gt; CON B: 3.89&amp;gt;= F4YC &amp;gt;= 2.39;&lt;BR /&gt; CON C: 4.49&amp;gt;= F5YC &amp;gt;= 2.44;&lt;BR /&gt;&lt;BR /&gt; solve with nlp /tech=ip ms msnumstarts=50 msprintlevel=5 printfreq=50 MSDISTTOL=10000;&lt;BR /&gt;&lt;BR /&gt;quit;
run; &lt;BR /&gt;&lt;BR /&gt;endrsubmit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2016 19:40:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/ERROR-Cannot-find-a-library-containing-subroutine-RUN-MACRO/m-p/317655#M1563</guid>
      <dc:creator>FrankB</dc:creator>
      <dc:date>2016-12-09T19:40:47Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Cannot find a library containing subroutine RUN_MACRO.</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/ERROR-Cannot-find-a-library-containing-subroutine-RUN-MACRO/m-p/317701#M1564</link>
      <description>&lt;P&gt;From the &lt;A href="http://support.sas.com/documentation/cdl/en/ormpug/66851/HTML/default/viewer.htm#ormpug_optmodel_details61.htm" target="_self"&gt;PROC OPTMODEL doc&lt;/A&gt;:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Not all PROC FCMP functionality is compatible with PROC OPTMODEL; in particular, the following FCMP functions are not supported and should not be called within your FCMP function definitions: READ_ARRAY, WRITE_ARRAY, RUN_MACRO, and RUN_SASFILE. In many cases, OPTMODEL capabilities can replace these functions. Matrix arguments can be used in place of the READ_ARRAY function by using the &lt;/SPAN&gt;&lt;A class="olink" href="http://support.sas.com/documentation/cdl/en/ormpug/66851/HTML/default/ormpug_optmodel_syntax11.htm#ormpug.optmodel.npxreadstmt" target="_blank"&gt;READ DATA&lt;/A&gt;&lt;SPAN&gt; statement to load the matrix in PROC OPTMODEL. Similarly, you can replace the WRITE_ARRAY function in an FCMP subroutine by copying the matrix to an output argument and using the OPTMODEL procedure to write the matrix. You can use the &lt;/SPAN&gt;&lt;A class="olink" href="http://support.sas.com/documentation/cdl/en/ormpug/66851/HTML/default/ormpug_optmodel_syntax11.htm#ormpug.optmodel.npxsubmitstmt" target="_blank"&gt;SUBMIT&lt;/A&gt;&lt;SPAN&gt; statement in place of the RUN_MACRO and RUN_SASFILE functions.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;That doesn't explain why you find that it works on your local SAS, unless perhaps more support was added in a later version of SAS and that's what you're running locally.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2016 21:24:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/ERROR-Cannot-find-a-library-containing-subroutine-RUN-MACRO/m-p/317701#M1564</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2016-12-08T21:24:10Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Cannot find a library containing subroutine RUN_MACRO.</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/ERROR-Cannot-find-a-library-containing-subroutine-RUN-MACRO/m-p/317906#M1565</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Thanks for the response.&lt;BR /&gt;&lt;BR /&gt;As I explained the proc fcmp is working well with proc optmodel on my&lt;BR /&gt;Windows PC but the error appears when I run it on UNIX server using&lt;BR /&gt;rsubmit. I believe the problem is not generated from proc optmodel but it's&lt;BR /&gt;only from the remote submit of proc fcmp since when I run the following&lt;BR /&gt;code I get the same error (ERROR: Cannot find a library containing&lt;BR /&gt;subroutine RUN_MACRO.).&lt;BR /&gt;&lt;BR /&gt;rsubmit ;&lt;BR /&gt;proc fcmp outlib=xwork.ds.functions;&lt;BR /&gt;&lt;BR /&gt;function Tot_profit(V5YC, F1YC, F2YC, F3YC, F4YC, F5YC,seg&lt;BR /&gt;$,peak,Num_comp_periods,Num_pay_period_year,Discount_rate,Free_Appr_cost,Amex_Point_Cost,cash_back_cost);&lt;BR /&gt;rc = run_macro('Profit',V5YC, F1YC, F2YC, F3YC, F4YC,&lt;BR /&gt;F5YC,seg,peak,Num_comp_periods,Num_pay_period_year,Discount_rate,Free_Appr_cost,Amex_Point_Cost,cash_back_cost,Sum_profit2,NII2,Vol2);&lt;BR /&gt;if rc eq 0 then return(Sum_profit2);&lt;BR /&gt;else return(.);&lt;BR /&gt;endsub;&lt;BR /&gt;&lt;BR /&gt;endrsubmit;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The reason that I'm using proc fcmp (called "Tot_profit") to create a&lt;BR /&gt;function which calls a macro function (called "Proft"). The Tot_profit&lt;BR /&gt;function is later called from proc optmodel to calculate the objective&lt;BR /&gt;function and the input arguments to that function is the optimization&lt;BR /&gt;variables and the outcome is the objective value which is supposed to be&lt;BR /&gt;maximized. If I just call the macro function directly from the proc&lt;BR /&gt;optmodel without utilizing the function created by proc fcmp then I get the&lt;BR /&gt;following error message for any line of code I add after calling the macro&lt;BR /&gt;function.&lt;BR /&gt;&lt;BR /&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;BR /&gt;&lt;BR /&gt;So please let me know your thoughts about the first error message from&lt;BR /&gt;remote submit of proc fcmp and also if you have any suggestion for calling&lt;BR /&gt;a macro function during optimization directly from proc optmodel without&lt;BR /&gt;utilizing proc fcmp.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Farshid&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;##- Please type your reply above this line. Simple formatting, no&lt;BR /&gt;attachments. -##</description>
      <pubDate>Fri, 09 Dec 2016 14:29:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/ERROR-Cannot-find-a-library-containing-subroutine-RUN-MACRO/m-p/317906#M1565</guid>
      <dc:creator>FrankB</dc:creator>
      <dc:date>2016-12-09T14:29:06Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Cannot find a library containing subroutine RUN_MACRO.</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/ERROR-Cannot-find-a-library-containing-subroutine-RUN-MACRO/m-p/317963#M1567</link>
      <description>&lt;P&gt;Can you please show&amp;nbsp;your Profit macro?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2016 18:43:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/ERROR-Cannot-find-a-library-containing-subroutine-RUN-MACRO/m-p/317963#M1567</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2016-12-09T18:43:10Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Cannot find a library containing subroutine RUN_MACRO.</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/ERROR-Cannot-find-a-library-containing-subroutine-RUN-MACRO/m-p/317974#M1569</link>
      <description>&lt;P&gt;Unfortunately I can't share the details but it involved several proc sqls and data steps to generate the output profit (SUM_PROFIT2) using the given inputs:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%MACRO Profit(seg=,....);


proc sql;
....
quit;



proc sql;
....
quit;



proc sql;
....
quit;


proc sql;
....
quit;


proc sql;
....
quit;

/*Summarize the costs*/
proc sql;
....
quit;

/*application costs*/
proc sql;
....
quit;


data APP_COST;
...
run;

/*Out_Profit*/
	
/*%let mydataid=%sysfunc(open(Out_Profit, i));*/
data _NULL_;
%GLOBAL SUM_PROFIT2;
	set OUT_PROFIT;
	call SYMPUT('SUM_PROFIT2',sum_profit);
run;
%let result = &amp;amp;SUM_PROFIT2;
%MEND Profit;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2016 19:37:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/ERROR-Cannot-find-a-library-containing-subroutine-RUN-MACRO/m-p/317974#M1569</guid>
      <dc:creator>FrankB</dc:creator>
      <dc:date>2016-12-09T19:37:56Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Cannot find a library containing subroutine RUN_MACRO.</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/ERROR-Cannot-find-a-library-containing-subroutine-RUN-MACRO/m-p/318351#M1578</link>
      <description>&lt;P&gt;I checked the version that I have on my local computer which was&amp;nbsp;9.03.01M1P110211 for Base SAS and the one that is running on UNIX server:&amp;nbsp;9.03.01M2P080112 . Although the one that runs on the server is more recent but the library error appears on this version but not the old version on my local.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Dec 2016 19:14:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/ERROR-Cannot-find-a-library-containing-subroutine-RUN-MACRO/m-p/318351#M1578</guid>
      <dc:creator>FrankB</dc:creator>
      <dc:date>2016-12-12T19:14:01Z</dc:date>
    </item>
  </channel>
</rss>

