Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: Solving a System of Equation in Stata

 From "C.T. Shehzad" To statalist@hsphsun2.harvard.edu Subject Re: st: Solving a System of Equation in Stata Date Wed, 02 Jun 2010 14:39:08 +0200

```Dear Maarten:

I tried to program using nl command but I get error. Apparently things
look in line with your suggested thread and stata help. can you spot
something that I am doing wrong? My program is blow.

Thanks and best regards,

Tanveer
. program nltanveer
. syntax varlist (min=1 max=1) [if], at(name)
. tempname vf svf zd1 zd2
. scalar `vf' = `at'[1,1]
. scalar `vfs' = `at'[1,2]
. scalar `zd1' = `at'[1,3]
. scalar `zd2' = `at'[1,4]
. tempvar z545
. gen double `z545' = [[equity +
(debt*(exp^(-ustbill))*normal(`zd2'))]/normal(`zd1')] + 1 - `vf' in 1
. replace `z545' = (eqvol*equity)/[(`vf')*normal(`d1') - `svf' in 2
. replace `z545' = [[log((`vf')/debt) + (ustbill + 0.5*
(`svf')^2)]/(`svf')] - `zd1' in 3
. replace `z545' = `zd1' - `vfs' - `zd2' in 4
. replace `varlist' = `z545'
. end

. set obs 150540
obs was 150540, now 150540
. gen y = 0
. replace y = 1 in 1
. nl tanveer @ y, parameters(vf svf zd1 zd2) initial (vf 1 svf 1 zd1 1
zd2 1)

nltanveer returned 198
verify that nltanveer is a function evaluator program
r(198);

Maarten buis wrote:
> --- On Tue, 1/6/10, C.T. Shehzad wrote:
>
>> I am trying to solve a system of equation in stata. I
>> understand how to do it in excel but its
>> implementation in stata looks problematic so your
>> help will be quite useful.
>>
>
> http://www.stata.com/support/faqs/lang/nl.html
>
> Hope this helps,
> Maarten
>
> --------------------------
> Maarten L. Buis
> Institut fuer Soziologie
> Universitaet Tuebingen
> Wilhelmstrasse 36
> 72074 Tuebingen
> Germany
>
> http://www.maartenbuis.nl
> --------------------------
>
>
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```