DATA Step, Macro, Functions and more

error on calling subroutines out of FCMP

Reply
N/A
Posts: 0

error on calling subroutines out of FCMP

hi guys,
this keeps giving me an error:

PGM:
proc fcmp outlib = sasuser.FCMP_Cat.fcns;
function SUMM(x,y);
z = x + y ;
return(z);
endsub;
quit;

options cmplib=(sasuser.FCMP_Cat);

data test;
som = SUMM(6,4);
run;

LOG:
6 proc fcmp outlib = sasuser.FCMP_Cat.fcns;
7 function SUMM(x,y);
8 z = x + y ;
9 return(z);
10 endsub;
11 quit;

NOTE: Function SUMM saved to catalog sasuser.FCMP_Cat.fcns.
NOTE: PROCEDURE FCMP used (Total process time):
real time 0.28 seconds
cpu time 0.01 seconds


12
13 options cmplib=(sasuser.FCMP_Cat);
14
15 data test;
16 som = SUMM(6,4);
----
68
ERROR 68-185: The function SUMM is unknown, or cannot be accessed.

17 run;
Super User
Posts: 5,426

Re: error on calling subroutines out of FCMP

Posted in reply to deleted_user
Maybe I'm on thin ice here, since I haven't done any coding (yet) with FCMP.
But looking into some examples in the online doc, maybe I could suggest something anyway...

It seems that if you are going to use the return() function, I think you are supposed to use the function name as argument, and also using the function name in the assignment statement as well. see:

http://support.sas.com/documentation/cdl/en/proc/59565/HTML/default/a002890491.htm

In your case, this would be:

proc fcmp outlib = sasuser.FCMP_Cat.fcns;
function SUMM(x,y);
summ = x + y ;
return(summ);
endsub;
quit;

Hope this helps...

Linus
Data never sleeps
N/A
Posts: 0

Re: error on calling subroutines out of FCMP

Posted in reply to deleted_user
another example copied out of a white paper that gives the same error:

proc fcmp outlib=sasuser.funcs.trial;
function study_day(intervention_date, event_date);
if event_date < intervention_date then
return(event_date - intervention_date);
else
return(event_date - intervention_date + 1);
endsub;
RUN;
quit;


options cmplib=sasuser.funcs;



data _null_;
start = '15Feb2006'd;
today = '27Mar2006'd;
sd = study_day(start, today);
put sd=;
run;


Regards,
Herman
Super User
Posts: 5,426

Re: error on calling subroutines out of FCMP

Posted in reply to deleted_user
If this is from an official SAS paper, I think It would be legitimate to open a track on SAS support.

/Linus
Data never sleeps
Respected Advisor
Posts: 3,799

Re: error on calling subroutines out of FCMP

Posted in reply to deleted_user
What version of SAS are you using? With 9.1.3 the PROC FCMP works but the function cannot be call from a data step. I think you need 9.2 for that.
Ask a Question
Discussion stats
  • 4 replies
  • 755 views
  • 0 likes
  • 3 in conversation