BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
InfoAlisaA
Calcite | Level 5

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

1 ACCEPTED SOLUTION

Accepted Solutions
InfoAlisaA
Calcite | Level 5

Never mind....just needed to change

options cmplib=orion.functions; to work.functions.

View solution in original post

1 REPLY 1
InfoAlisaA
Calcite | Level 5

Never mind....just needed to change

options cmplib=orion.functions; to work.functions.

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
  • 1 reply
  • 629 views
  • 0 likes
  • 1 in conversation