```Date: Mon, 12 Apr 2010 11:45:40 -0400 Reply-To: Ban Cheah Sender: "SAS(r) Discussion" From: Ban Cheah Subject: PROC OPTMODEL in SAS 9.1.3 The problem is the following: I plan to retire in year 5 and expect to live 8 years. For each of those 8 years, I plan to spend 30,000 per year. How much must I put into my savings account from years 0 to 4 if my return from saving is 8 percent? The code is as follows: proc optmodel; number rate = 0.08; number life = 13; number year; number cf{1..life} init -30000; var add_amt init 30000; do year = 0 to 4; cf[year+1]=add_amt; end; min z = sum {i in 0..12} (cf[i+1]/((1+rate)**(i))); con add_amt>=0, z=0; solve ; print add_amt; quit; OPTMODEL is unable to solve this problem - the note in the log is: The constraint '_ACON_[2]' is empty and infeasible. Constraint _ACON_[2] causes the problem to be infeasible. The solution (using Excel's Solver) is add_amt = 29386.55 If I rephrase the problem as the following: If I save 29,386.55 per year, what must my return be? The code is as follows: proc optmodel; number life = 13; number year; number cf{1..life} init -30000; number add_amt init 29386.55; var rate; do year = 0 to 4; cf[year+1]=add_amt; end; min z = sum {i in 0..12} (cf[i+1]/((1+rate)**(i))); con add_amt>=0, z=0; solve ; print rate; quit; OPTMODEL returns the correct answer as 0.08. I'm running OPTMODEL in 9.1.3 SP4 which is experimental. Perhaps this is the problem? Or is the first code incorrectly specified? Thanks. ```

Back to: Top of message | Previous page | Main SAS-L page