impose a long constraint in nonlin

Use this forum to post questions about syntax problems or general programming issues. Questions on implementing a particular aspect of econometrics should go in "Econometrics Issues" below.
Catife
Posts: 9
Joined: Sun Mar 20, 2016 10:18 pm

impose a long constraint in nonlin

Unread post by Catife »

Dear Tom,

I just have a question about how to impose a long constraint in nonlin. For example, I want to impose the following constraint after declaring parameters

Code: Select all

nonlin(parmset=test) a b c d e f g (a^b^c^d^e^f^g+c+f*g $     * suppose this row has no more space
                       - c^100)/c^5==(a^b^c^d^e^f^g+c+f*g)    
I will get an error:

Code: Select all

## SX20. Expected )
    >>>>+c+f*g <<<<
I guess the problem is from the incomplete bracket and I can not shorten the constraint. Could you please let me know how to deal with this situation? Thank you very much.

Regards
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: impose a long constraint in nonlin

Unread post by TomDoan »

Parmset fields are separated by spaces, so once you have that space, it's assumed to be done. Can't you just rearrange it to

nonlin(parmset=test) a b c d e f g $
(a^b^c^d^e^f^g+c+f*g-c^100)/c^5==(a^b^c^d^e^f^g+c+f*g)

putting the $ between fields rather than in the middle.
Catife
Posts: 9
Joined: Sun Mar 20, 2016 10:18 pm

Re: impose a long constraint in nonlin

Unread post by Catife »

Thank you for the reply. The actual constraint is longer than the example so that I could not fix that by rearranging it. I think I will try to simplify the constraint. Thank you very much.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: impose a long constraint in nonlin

Unread post by TomDoan »

You can go up to 256 characters on a line. However, I would be really concerned about getting a constraint that's that long input properly. You can simplify your sample to something like

nonlin(parmset=test) a b c d e f g powers=a^b^c^d^e^f^g $
(powers+c+f*g-c^100)/c^5==(powers+c+f*g)
Post Reply