BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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;
4 REPLIES 4
LinusH
Tourmaline | Level 20
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
deleted_user
Not applicable
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
LinusH
Tourmaline | Level 20
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
data_null__
Jade | Level 19
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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 2145 views
  • 0 likes
  • 3 in conversation