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

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;

1 ACCEPTED SOLUTION

Accepted Solutions
art297
Opal | Level 21

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;

View solution in original post

5 REPLIES 5
DLing
Obsidian | Level 7

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.

skallamp
Obsidian | Level 7

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;

art297
Opal | Level 21

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;

skallamp
Obsidian | Level 7

Thanks a lot Art297.

Ksharp
Super User

It would be helpful if you can post all the content of log.

options mprint mlogic symbolgen;

Ksharp

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
  • 5 replies
  • 978 views
  • 0 likes
  • 4 in conversation