*! version 1.0.0 20may2010
help vlgen

Title

vlgen -- Generate or replace variable labels automatically while generating or replacing the variable.

Syntax

vlgen
varname
{=exp}
[if] [in]
[,
options]

vlgen (variable and label generate) acts much like labgen, but uses labels one from one
level deeper -- see examples below.

replace replace an existing variable and label

nopromote same as nopromote option with replace, see replace

noconditionals keeps "if" and "in" statements out of the label

Examples

Comparing labgen and vlgen

Suppose your data set contains the following variables.

Name Label

x1 blah
x2
x3 etc

After

. labgen x4 = x1+x3

you would have

Name Label

x1 blah
x2
x3 etc
x4 x1+x3

If instead you used

. vlgen x4 = x1+x3

you would have

Name Label

x1 blah
x2
x3 etc
x4 blah + etc

If a variable has no label, the variable name is used, as in labgen.

. vlgen x5 = x1 + x2

would give you

Name Label

x1 blah
x2
x3 etc
x4 blah + etc
x5 blah + x2

Using the replace option

Starting with the data set

Name Label

x1 blah
x2
x3 etc
x4 blah + etc

. vlgen x4 = abs(x1) + x2, replace

would give you

Name Label

x1 blah
x2
x3 etc
x4 abs( blah ) + etc

replacing both variable values and label.

Author

James Fiedler, Universities Space Research Association

Email: james.fiedler-1@nasa.gov