BookmarkSubscribeRSS Feed
sarathgk
Fluorite | Level 6

Hi,

 

I have the following code in the optmodel:

 

for {i in rxid} do;
if calculation[i] = 1 and dollars[i] =1 > current_copay[i] +5 then do;
fix copay1_lhs[i]= n_ingred_cost[i] + n_disp_fee_final[i] ;
fix copay1_rhs[i]=(current_copay[i] +5) - bill_tax[i];
end;
end;
con c28{i in rxid}:copay1_lhs[i] <= copay1_rhs[i];

 

when i expand it, i see the results below

 

Constraint c28[674523592]: copay1_lhs[674523592] - copay1_rhs[674523592] <= 0
Constraint c28[674563238]: copay1_lhs[674563238] - copay1_rhs[674563238] <= 0
Constraint c28[674563792]: copay1_lhs[674563792] - copay1_rhs[674563792] <= 0

 

is it right to pass the variable in the constraint function; please help

 

thanks in advance

3 REPLIES 3
RobPratt
SAS Super FREQ

I think you want the following:

   con c28{i in rxid: calculation[i] = 1 and dollars[i] = 1 > current_copay[i] + 5}:
      n_ingred_cost[i] + n_disp_fee_final[i] <= (current_copay[i] + 5) - bill_tax[i];
sarathgk
Fluorite | Level 6

ya exactly, i tried your code ,but could not see anything in the expand results. will the constraints be applied there?

RobPratt
SAS Super FREQ

If the logical conditions after the colon operator are never satisfied, then the index set is empty and EXPAND will not display anything.  This part of the condition is suspicious:

dollars[i] = 1 > current_copay[i] + 5

What is the intent here?

Ready to join fellow brilliant minds for the SAS Hackathon?

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!
Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 877 views
  • 0 likes
  • 2 in conversation