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;

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

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
  • 2 replies
  • 805 views
  • 0 likes
  • 3 in conversation