Hello Everyone,
So I have the following program in my homework:
data test;
set orion.order_fact(keep=Employee_ID Quantity
Total_Retail_Price);
if Quantity>2 then Kick_Back_Amt=Quantity*Total_Retail_Price/5;
else Kick_Back_Amt=Quantity*Total_Retail_Price/10;
run;
proc print data=test(obs=5);
run;
I have to take this program and create a PROC FCMP where I have a formula stored that I can query later.
This is my program so far:
options cmplib=orion.functions;
proc fcmp outlib=work.functions.Marketing;
function kb(Quantity, Total_Retail_Price) $50;
if Quantity>2 then return (Quantity*Total_Retail_Price/5);
else return (Quantity*Total_Retail_Price/10);
endsub;
run;
quit;
data kick_backs;
set orion.order_fact;
Kick_Back_Amt=kb(Quantity, Total_Retail_Price);
run;
proc print data=kick_backs (obs=5);
run;
However, when I try to access my formula, I get the following:
472 options cmplib=orion.functions;
473 proc fcmp outlib=work.functions.Marketing;
474 function kb(Quantity1, Total_Retail_Price) $50;
475 if Quantity>2 then return (Quantity1*Total_Retail_Price/5);
NOTE: Numeric value converted to character.
476 else return (Quantity1*Total_Retail_Price/10);
NOTE: Numeric value converted to character.
477 endsub;
478 run;
NOTE: Function kb saved to work.functions.Marketing.
NOTE: PROCEDURE FCMP used (Total process time):
real time 0.20 seconds
cpu time 0.03 seconds
479 quit;
480
481 /*part c*/
482 data kick_backs;
483 set orion.order_fact;
484 Kick_Back_Amt=kb(Quantity, Total_Retail_Price);
484 Kick_Back_Amt=kb(Quantity, Total_Retail_Price);
--
68
ERROR 68-185: The function KB is unknown, or cannot be accessed.
485 run;
I am not sure where I am going wrong with my program, but if someone could take a look at it and let me know, it will be greatly appreciated.
Thanks!
Alisa
Never mind....just needed to change
options cmplib=orion.functions; to work.functions.
Never mind....just needed to change
options cmplib=orion.functions; to work.functions.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.