*! version 3.2.1 13Aug2013
help vy (the short form of 'validly' -- see help validly)

Title

vy -- as validly:

generate or replace a variable, or run conditional commands,
correctly handling missing values in logical/relational expressions

Corrects Stata's mishandling of logical/relational missing values

Why this is necessary is explained in the Description and, more fully, in the
Discussion section.

Index

(clickable links to the relevant sections of help validly)
Syntax
Description
Options

Discussion - [ explains why it matters]

Examples
Method
Functions

Utilities
Restrictions
Error messages
Saved results
Reference
Contact

As generate or replace, but, in contrast to unmodified Stata,
using valid functional forms for any logical or relational expression:

vy generate [type]
newvar [:lblname]
= exp
[if] [in]
[,options]

vy replace
varname
= exp
[if] [in]
[,options]

There is also an extension of substantive syntax,
to handle "condition False" and "condition indeterminate",
in addition to the standard "condition True" states; restricted, if desired, to a subset of observations:

vy generate|replace
var
= exp
[if] [in]
[, ifnot(expN) else(expE) when(expW) options]

Simplifications:
replace can be abbreviated to rep;
and generate/replace can be completely omitted and are then imputed from
the existential status of var.

Also as assert, but using valid functional forms for any logical or relational expression:

vy assert
exp
[if] [in]
[,options]

For other non-assignment conditional commands, vy can act as a modifier or 'wrapper':

vy
conditional_command [, its options]
[,, validly's_options]

vy locates the conditional expression, replaces it
by a valid functional form, and executes the `wrapped' command (see example).

(Slightly inelegantly, but of necessity, vy's
options appear after double commas, to differentiate them from the command's options)

The functional macros, used implicitly in the valid commands,
can also be explicitly requested, in one of two forms:

vy global
mname
exp
[, options]

vy global
mname if exp
[, options]

Both return global macro $mname. The first form returns a version of exp evaluating validly to T, F or missing,
The second form treats missing values (from a validly evaluated exp) as False, and returns "if exp", so defined, to constrain Stata
to select only when the condition is in fact true. (Click through
for examples of first form and second form use.)

+

| goto Index
+