Stata 15 help for functions

[FN] Functions by category

Description

Quick references are available for the following types of functions:

+--------------------------------------------------------+ | Type of function | See help | |------------------------------+-------------------------| | Date and time | datetime functions | | | | | Mathematical | mathematical functions | | | | | Matrix | matrix functions | | | | | Programming | programming functions | | | | | Random-number | random-number functions | | | | | Selecting time spans | time-series functions | | | | | Statistical | statistical functions | | | | | String | string functions | | | | | Trigonometric | trigonometric 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)


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