Stata 15 help for args

args (in [P] syntax) -- Parse Stata syntax positionally

Syntax

args macroname1 [macroname2 [macroname3 ...]]

Description

args obtains command line arguments. It works on positional arguments -- the first, second, ... item entered on a command line. The syntax command is a more comprehensive command that also obtains command line arguments but does so according to Stata's language grammar. For an introduction to Stata's language, see language.

args assigns the first command line argument to the local macro macroname1, the second argument to macroname2, and so on. In the program, you subsequently refer to the contents of the macros by enclosing their names in single quotes: `macroname1', `macroname2', etc.

Examples

program myprog version 15.1 args varname dof beta ... (program uses macros `varname', `dof', and `beta') ... end

. myprog mpg 32 8.2

In this case `varname' is set to mpg, `dof' is set to 32, `beta' is set to 8.2.


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