BookmarkSubscribeRSS Feed
AlexeyS
Pyrite | Level 9

I use proc model for solver.

I want to add conditional restrict statement, i.e for some observation I want to add restrict. Can I do it?

Thank you

 

 

2 REPLIES 2
mitrov
SAS Employee

Duh, ignore my previous comments. I thought you were talking about PROC TSMODEL. 

kessler
SAS Employee

You can restrict your solution conditionally by using the OPTIMIZE option on the SOLVE statement. Below is an example of a simple case where only the solution for the 9th observation is restricted to be less than or equal to 8. Please let me know if you had something else in mind.

 

data d;
   do t=1 to 10;
	   output;
	end;
run;

proc model data=d;
   y = t**2/10;
	solve y / optimize out=o;
	restrict ifn(t=9,y,0) <= 8;
quit;

proc print data=o;
run;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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