Can someone please help me to fix this macro issue? I cant find anything from the log file...
%LEt Retail_30_B = .165;
%Let Retail_30_G = .165;
%Let Retail_30_B_DF = 1;
%Let Retail_30_G_DF = 1;
%LEt Retail_90_B = .165;
%Let Retail_90_G = .165;
%Let Retail_90_B_DF = 1;
%Let Retail_90_G_DF = 1;
%Let Mail_B = .25;
%Let Mail_G = .73;
%Let MAil_B_DF = 0;
%Let Mail_G_DF = 0;
%Let Specialty_Disc = .17;
%Let Specialty_DF = 0;
data final;
set Claims_Join;
MAC = macunitcost_num * qty_disp;
format Ingrediant_Cost 15.5 Final_ING_Cost 15.5;
if retail90_30 = 'Retail 30'and Type = 'Brand' then Ingrediant_Cost = Pre_AWP*(1-(&Retail_30_B.));
else if retail90_30 = 'Retail 30' and type = 'Generic' and MAC = . then Ingrediant_Cost = Pre_AWP*(1-(&Retail_30_G.));
else if type = 'Generic' and MAC <> . then Ingrediant_Cost = MAC;
else if retail90_30 = 'Retail 90'and Type = 'Brand' then Ingrediant_Cost = Pre_AWP*(1-(&Retail_90_B.));
else if retail90_30 = 'Retail 90' and type = 'Generic' and MAC = . then Ingrediant_Cost = Pre_AWP*(1-(&Retail_90_G.));
else specialty_ind = 'Y' then Ingrediant_Cost = Pre_AWP*(1-(&Specialty_Disc.));
Final_ING_Cost = min(U_and_C, Ingrediant_Costpe);
run;
It would really help if you provided sample data, in the form of a datastep, when posting your questions.
I would think that the following is closer to what you were trying to submit. The problems I noticed were the use of <> which I presume meant NE, a statement where you indicated else specialty_ind=etc., etc, but looked like you meant else if, and you have a variable that may or may not be misspelled Ingrediant_Costpe (above and beyond the Ingrediant part), a the use of single quotes around variables that contain spaces:
data final;
set Claims_Join;
MAC = macunitcost_num * qty_disp;
format Ingrediant_Cost 15.5 Final_ING_Cost 15.5;
if retail90_30 = "Retail 30" and Type = 'Brand' then Ingrediant_Cost = Pre_AWP*(1-(&Retail_30_B.));
else if retail90_30 = "Retail 30" and type = 'Generic' and MAC = . then Ingrediant_Cost = Pre_AWP*(1-(&Retail_30_G.));
else if type = 'Generic' and MAC NE . then Ingrediant_Cost = MAC;
else if retail90_30 = "Retail 90" and Type = 'Brand' then Ingrediant_Cost = Pre_AWP*(1-(&Retail_90_B.));
else if retail90_30 = "Retail 90" and type = 'Generic' and MAC = . then Ingrediant_Cost = Pre_AWP*(1-(&Retail_90_G.));
else IF specialty_ind = 'Y' then Ingrediant_Cost = Pre_AWP*(1-(&Specialty_Disc.));
Final_ING_Cost = min(U_and_C, Ingrediant_Cost);
run;
There's not enough information to help you yet. Can you turn on macro diagnostics like: options mprint macrogen; ahead of your macro, submit, and post the log please.
ERROR 388-185: Expecting an arithmetic operator.
Is there any syntax error here?
data Claims_final;
set Claims_Join;
MAC = macunitcost_num * qty_disp;
format Ingrediant_Cost 15.5 Final_ING_Cost 15.5;
if retail90_30 = 'Retail 30'and Type = 'Brand' then Ingrediant_Cost = Pre_AWP*(1-(&Retail_30_B.));
else if retail90_30 = 'Retail 30' and Type = 'Generic' and MAC = . then Ingrediant_Cost = Pre_AWP*(1-(&Retail_30_G.));
else if type = 'Generic' and MAC <> . then Ingrediant_Cost = MAC;
else if retail90_30 = 'Retail 90'and Type = 'Brand' then Ingrediant_Cost = Pre_AWP*(1-(&Retail_90_B.));
else if retail90_30 = 'Retail 90' and Type = 'Generic' and MAC = . then Ingrediant_Cost = Pre_AWP*(1-(&Retail_90_G.));
else specialty_ind = 'Y' then Ingrediant_Cost = Pre_AWP*(1-(&Specialty_Disc.));
Final_ING_Cost = min(U_and_C, Ingrediant_Costpe);
run;
It would really help if you provided sample data, in the form of a datastep, when posting your questions.
I would think that the following is closer to what you were trying to submit. The problems I noticed were the use of <> which I presume meant NE, a statement where you indicated else specialty_ind=etc., etc, but looked like you meant else if, and you have a variable that may or may not be misspelled Ingrediant_Costpe (above and beyond the Ingrediant part), a the use of single quotes around variables that contain spaces:
data final;
set Claims_Join;
MAC = macunitcost_num * qty_disp;
format Ingrediant_Cost 15.5 Final_ING_Cost 15.5;
if retail90_30 = "Retail 30" and Type = 'Brand' then Ingrediant_Cost = Pre_AWP*(1-(&Retail_30_B.));
else if retail90_30 = "Retail 30" and type = 'Generic' and MAC = . then Ingrediant_Cost = Pre_AWP*(1-(&Retail_30_G.));
else if type = 'Generic' and MAC NE . then Ingrediant_Cost = MAC;
else if retail90_30 = "Retail 90" and Type = 'Brand' then Ingrediant_Cost = Pre_AWP*(1-(&Retail_90_B.));
else if retail90_30 = "Retail 90" and type = 'Generic' and MAC = . then Ingrediant_Cost = Pre_AWP*(1-(&Retail_90_G.));
else IF specialty_ind = 'Y' then Ingrediant_Cost = Pre_AWP*(1-(&Specialty_Disc.));
Final_ING_Cost = min(U_and_C, Ingrediant_Cost);
run;
Thanks a lot Art297.
It would be helpful if you can post all the content of log.
options mprint mlogic symbolgen;
Ksharp
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.
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.