BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi all,

I should disclaim all of this by saying that I'm fairly new to SAS programming, so I could be missing something obvious, but I'm having a strange problem with proc fcmp on my SAS 9.1.3 SP 4 server. I'm trying to run the following program:

proc fcmp outlib=work.funcs.comn;
function adw (Theo, Actual, Days);
if Actual > (Theo*0.4) then
return(Actual/Days);
else
return((Theo*0.4)/Days);
endsub;
quit;

options cmplib=work.funcs;

data _null_;
OutAdw = adw(100, 75, 10);
put OutAdw=;
run;

However, I get the error "The function ADW is unknown, or cannot be accessed. From what I read, I thought the options cmplib=work.funcs; would solve that. Can anyone tell me what I'm doing wrong? Here's the full log, just for good measure...

1 proc fcmp outlib=work.funcs.comn;
2 function adw (Theo, Actual, Days);
3 if Actual > (Theo*0.4) then
4 return(Actual/Days);
5 else
6 return((Theo*0.4)/Days);
7 endsub;
8 quit;

NOTE: Function adw saved to catalog work.funcs.comn.
NOTE: PROCEDURE FCMP used (Total process time):
real time 0.26 seconds
cpu time 0.21 seconds


9
10 options cmplib=work.funcs;
11
12 data _null_;
13 OutAdw = adw(100, 75, 10);
---
68
ERROR 68-185: The function ADW is unknown, or cannot be accessed.

14
15 put OutAdw=;
16 run;

NOTE: The SAS System stopped processing this step because of errors.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
2 REPLIES 2
ChrisNZ
Tourmaline | Level 20
The SAS Function Compiler (FCMP) Procedure allows users to create, test, and store SAS functions and subroutines for use by other SAS procedures.
The following SAS procedures allow the use of the functions and subroutines created by FCMP:
• CALIS
• COMPILE
• DISTANCE
• GA
• GENMOD
• MODEL
• NLIN
• NLMIXED
• NLP
• PHREG
• RISK DIMENSIONS
• ROBUSTREG
• SIMILAR
• SYLK

In SAS 9.2, FCMP routines can be called from the DATA step like any other SAS function.
deleted_user
Not applicable
D'oh! I'd seen some stuff saying that FCMP worked in SAS 9.2, but nothing that explicitly said it wouldn't work in 9.1.3. And since it took the proc without complaining, I figured I was doing something wrong in the code.

That makes more sense. Thanks for shedding some light on that for me!

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 2 replies
  • 1164 views
  • 0 likes
  • 2 in conversation