title: SAS: How to numerically recover a parameter from an equation involving integration?
body: <p>I aim to find a (alpha) that satisfies the below equation, where F and p are given</p>
  
  <p><a href="https://i.stack.imgur.com/D3qnQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/D3qnQ.png" alt="enter image description here"></a></p>
  
  <p>To give a concrete example, suppose we aim to find alpha that satisfies the below given constants p, l, and u:</p>
  
  <p><a href="https://i.stack.imgur.com/vBH6E.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vBH6E.png" alt="enter image description here"></a></p>
  
  <p>How do I do it in SAS? I am open to solutions in <code>proc IML</code> or any other package. But bonus points for using a solution that doesn't involve <code>SAS/OR</code> as that is not available to me.</p>
  
  <p>I am really struggling to come up with a MWE (apart from writing out a long 200-line solution using macros) but from my research I think <code>proc nlin</code> seem promising, but I think the examples in the doc all optimize a target and the RHS (explanatory data) provided that they sit on the data-row. There is no example where we aggregate the data-rows (to simulate integration) and then recover the parameter(s).</p>
  
  <p>This can be solved using a one-liner in R (most of the time), plus the code needed to define the function <code>F</code>, and the sum of squares of the difference between <code>p</code> and the integral (which is around 50 lines in my case with comments).</p>
  
  <pre><code>optim(init_params, F)
  </code></pre>
  
  <p>so I think there is a solution in SAS that is sub 10 lines long.</p>