BookmarkSubscribeRSS Feed
Satyakshma
Fluorite | Level 6

Hello All

I'm trying to replicate in SAS a procedure I use in Excel. This procedure is basically an iterative solver (through a macro) that puts the variable Delta (Sum square error of actual and predicted value) to minimum value by changing the values of the Index value(starting with null values) used to calculate predict value.

 

The input data start like this:

bucketscoreactualpredicteddeltaindex
1-2.382190.011488...
2-0.642830.323792...
3-0.190960.5008...
40.3793140.693121...

 

- bucket, score and actual are inputs;

- index values are generated by Excel; Used in calculating predicted which is further used to find the delta

- predicted is given by NORM.S.DIST(score + index, TRUE)

- Delta is minimum sum square error (actual, predicted)

 

The solver objective function is Delta, it operates by changing index values and the constraint is predicted value should be such that minimum delta value. It runs for each cell.

 

After solver macro, the desired output is:

 

bucketscoreactualpredicteddeltaindex
1-2.382190.0114880.0135010.0003591050.170699
2-0.642830.3237920.3184160.0003591050.170699
3-0.190960.50080.4919160.0003591050.170699
40.3793140.6931210.7088450.0003591050.170699

 

Is there a way to do this in SAS except  for proc optmodel as I don't have license for SAS/OR? 

 

I have been trying and searching for a few days, without success.

 

If anyone could help with the code for this, it would be very much helpful and appreciated.

 

Kind Regards,

Satyakshma Rawat

3 REPLIES 3
Reeza
Super User
Yes, this is doable in SAS in a data step. You should probably start by providing data as data steps and trying to solve some of it yourself though. At least some of the basic stuff - ie generating the random values and getting the normal distribution calcs. Basically get the first iteration done and then we can show you how to iterate it to get it all working.
Satyakshma
Fluorite | Level 6
Hi Reeza,

I am facing problem in generating random values itself. I am not able to identify the way to generate random values using which I can do normal distribution calculations.
Satyakshma
Fluorite | Level 6
As the generation of random values to calculate the normal distribution is dependent on the constraint that delta value should be minimum. As I am new to SAS, I am facing difficulty in writing code to satisfy the constraint and generate results.

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

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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