Stata 11 help for functions

help functions -------------------------------------------------------------------------------

Title

[D] functions -- Functions in expressions

Quick references are available for the following types of functions:

+----------------------------------------------------------------+ | Type of function | See help | |--------------------------------------+-------------------------| | Mathematical functions | math functions | | | | | Probability distributions and | | | density functions | density functions | | | | | Random-number functions | random-number functions | | | | | String functions | string functions | | | | | Programming functions | programming functions | | | | | Date and time functions | dates and times | | | | | Selecting time spans | time-series functions | | | | | Matrix functions | matrix functions | | | | +----------------------------------------------------------------+

Introduction

Functions are used in expressions, which are abbreviated exp in syntax diagrams. For example, a simplified version of generate's syntax is

generate newvar = exp

and thus, one might type "generate loginc = ln(income)". ln() is a function.

Functions may be specified in any expression. The arguments of a function may be any expression, including other functions.

A function's arguments are enclosed in parentheses and, if there are multiple arguments, separated by commas.

Functions return missing (.) when the value of the function is undefined.

Examples

. generate y = sqrt(abs(z*z-x*x-y))

. gen str20 new = cond(sex=="m","Mr. ", "Ms. ") + proper(name)

Also see

Manual: [D] functions

Help: [D] egen, [D] generate, [U] 13 Functions and expressions (expressions), [U] 13 Functions and expressions (operators)


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