Stata 11 help for operators

help operators -------------------------------------------------------------------------------

Title

Operators in expressions (found in [U] 13 Functions and expressions)

Syntax

Relational Arithmetic Logical (numeric and string) -------------------- ------------------ --------------------- + addition & and > greater than - subtraction | or < less than * multiplication ! not >= > or equal / division ~ not <= < or equal ^ power == equal - negation != not equal + string concatenation ~= not equal

A double equal sign (==) is used for equality testing.

The order of evaluation (from first to last) of all operators is ! (or ~), ^, - (negation), /, *, - (subtraction), +, != (or ~=), >, <, <=, >=, ==, &, and |.

Examples

. sysuse auto . generate weight2 = weight^2 . count if rep78 > 4 . count if rep78 > 4 & weight < 3000 . list make if rep78 == 5 | mpg > 25

Also see

Manual: [U] 13 Functions and expressions, [U] 13.2 Operators

Help: [U] 13 Functions and expressions, [D] functions; [D] egen, [D] generate


© Copyright 1996–2009 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index