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.
rsubmit;
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;
options cmplib=work.ds;
proc optmodel;
VAR V5YC init 1, F1YC init 1,F2YC init 0,F3YC init 3.20111035,F4YC init 3.20111035,F5YC init 3.20111035;
MAX Total_profit = Tot_profit( V5YC, ... );
CON A: 3.29>= F3YC >= 2.89;
CON B: 3.89>= F4YC >= 2.39;
CON C: 4.49>= F5YC >= 2.44;
solve with nlp /tech=ip ms msnumstarts=50 msprintlevel=5 printfreq=50 MSDISTTOL=10000;
quit;
run;
endrsubmit;
From the PROC OPTMODEL doc:
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 READ DATA 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 SUBMIT statement in place of the RUN_MACRO and RUN_SASFILE functions.
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.
Can you please show your Profit macro?
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:
%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 = &SUM_PROFIT2; %MEND Profit;
I checked the version that I have on my local computer which was 9.03.01M1P110211 for Base SAS and the one that is running on UNIX server: 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.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.
Find more tutorials on the SAS Users YouTube channel.