BookmarkSubscribeRSS Feed
ciro
Quartz | Level 8

hi all,

first of all, I am quite new to optimization problems and their programming, so I apologize for any possible lack of clarity.

I would like to calculate coeffincients x(i)'s, as much as possibe close to d(i)'s,  such that a weighted sum of x(i) is equal to a known value.

 

min f((x(i),d(i))

 

s.t. sum(y(i)x(i))=Y

s.t. y(i)x(i) >=0

s.t. y(i)x(i)<=c*z(i)

 

where f(.) would be a distance function summarizing the distances between x(i) and d(i), e.g a quadratic function (suggestions are welcome).

y(i),Y,,c,z(i),d(i) are known values

In other terms it is a calibration problem with the addition of inequality constraints.

These values are stored in a sas dataset, and i would like the procedure to add the x(i)'s to the dataset.

 

A second issue is to repeat the algorithm for a number of groups. So a solution with a by processing would be much appreciated.

a group may have up to 200000 observations.

 

I can use SAS-OR or sas IML. I would prefer the first choice in order to learn a new tool.

thank you very much in advance

 

 

 

2 REPLIES 2
RobPratt
SAS Super FREQ

Yes, your constrained regression problem sounds like a good fit for SAS/OR.  You can use the OPTMODEL procedure to model and solve the problem:

http://support.sas.com/documentation/cdl/en/ormpug/68156/HTML/default/viewer.htm#ormpug_optmodel_toc...

 

To solve separate groups independently, see this Usage Note, which has a quadratic objective and uses the QP solver:

http://support.sas.com/kb/42/332.html

 

In SAS/OR 13.1 or later, you can even solve these independent problems in parallel by using a COFOR loop:

http://support.sas.com/documentation/cdl/en/ormpug/68156/HTML/default/viewer.htm#ormpug_optmodel_syn...

 

This example illustrates changing a DO loop to a COFOR loop:

http://support.sas.com/documentation/cdl/en/ormpex/68157/HTML/default/viewer.htm#ormpex_ex22_toc.htm

Ksharp
Super User

It looks like IML can get it.

Can you post a real example ?

 

y(i)x(i) >=0

means

y(i)*x(i) >=0

?

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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