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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 2123 views
  • 0 likes
  • 3 in conversation