**[R] constraint** -- Define and list constraints

__Syntax__

Define constraints

__cons__**traint** [__de__**fine**] *#* [*exp* **=** *exp* | *coeflist*]

List constraints

__cons__**traint** __d__**ir** [*numlist*|**_all**]

__cons__**traint** __l__**ist** [*numlist*|**_all**]

Drop constraints

__cons__**traint** **drop** {*numlist*|**_all**}

Programmer's commands

__cons__**traint** **get** *#*

__cons__**traint** **free**

where *coeflist* is as defined in **[R] test** and *#* is restricted to the range
1 to 1,999, inclusive.

__Menu__

**Statistics > Other > Manage constraints**

__Description__

**constraint** defines, lists, and drops linear constraints. Constraints are
for use by models that allow constrained estimation.

Constraints are defined by the **constraint** command. The currently defined
constraints can be listed by either **constraint list** or **constraint dir**;
both do the same thing. Existing constraints can be eliminated by
**constraint drop**.

**constraint get** and **constraint free** are programmer's commands. **constraint**
**get** returns the contents of the specified constraint in macro **r(contents)**
and returns in scalar **r(defined)** 0 or 1 -- 1 being returned if the
constraint was defined. **constraint free** returns the number of a free
(unused) constraint in macro **r(free)**.

__Examples__

For use with **cnsreg** (where there is one equation):

**. sysuse auto**
**. constraint 1 price = weight**
**. cnsreg mpg price weight, constraints(1)**

For use with **mlogit** (where there are multiple equations):

**. webuse sysdsn1**
**. constraint 2 [Uninsure]2.site = 0**
**. mlogit insure age male i.site, constraints(2)**

**. constraint 10 [Indemnity]: 2.site 3.site**
**. constraint 11 [Indemnity=Prepaid]: 3.site**
**. mlogit insure age male i.site, constraints(10/11) baseoutcome(3)**

In all cases:

**. constraint drop 1, 10-11**
**. constraint drop _all**