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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 441 views
  • 0 likes
  • 3 in conversation