Differences between revisions 1 and 5 (spanning 4 versions)
Revision 1 as of 2023-01-13 21:56:41
Size: 294
Comment:
Revision 5 as of 2023-06-09 12:51:35
Size: 794
Comment:
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:

In the Stata programming language, a '''program''' is a reusable functions.
Line 11: Line 13:
Stata programs are defined using the `program` command. Programs are defined using the `program` command.
Line 24: Line 26:
----



== Usage ==

To list all defined programs, try:

{{{
program dir
}}}

To examine a program, try:

{{{
program list foo
}}}

Use `program list _all` to list the contents of all programs.

To delete a program, try:

{{{
program drop foo
}}}

Use `program drop _all` to delete all programs and `program drop _allado` to delete all programs that were loaded from [[Stata/AdoFiles|ado files]].

Stata Programs

In the Stata programming language, a program is a reusable functions.


Definition

Programs are defined using the program command.

program foo
  args a b
  if "`b'"=="" {
    di "Expected 2 arguments (got 1)"
    exit
  }
  gen `a'=`b'
end


Usage

To list all defined programs, try:

program dir

To examine a program, try:

program list foo

Use program list _all to list the contents of all programs.

To delete a program, try:

program drop foo

Use program drop _all to delete all programs and program drop _allado to delete all programs that were loaded from ado files.


CategoryRicottone

Stata/Programs (last edited 2023-06-09 12:51:35 by DominicRicottone)