@inlist |

Dummy variable for observation value in list.

Syntax: @inlist(x, list)

x: number or string

list: number or string

Return: number

where list is a quoted, space delimited list of values.

Returns a dummy variable series equal to 1 for observations where x is equal to one of the values specified in list, and 0 otherwise.

Note that string comparisons are case sensitive.

Examples

series d1 = @inlist(x, "1 3 5 7 9")

creates a dummy variable that takes the value 1 where X equals 1, 3, 5, 7, or 9, and 0 otherwise.

series d2 = @inlist(a, """no problem"" help")

creates a dummy variable that takes the value 1 for observations in A that equal “no problem” or “help”, and 0 otherwise.

Cross-references

See also
@between.