Skip to content

Stata

Templates

**# Setup
version 19
frame reset

local output_path "../output"
local temp_path "../temp"

* ============================================================================ *
**# 
* ============================================================================ *

Snippets

Heading
* ============================================================================ *
**# 
* ============================================================================ *
* ============================================================================ *
**## 
* ============================================================================ *
* ---------------------------------------------------------------------------- *
**##
* ---------------------------------------------------------------------------- *
* ---------------------------------------------------------------------------- *
**###
* ---------------------------------------------------------------------------- *
Copied code
* ---------------------------------------------------------------------------- *
* Start of copied code.
* ---------------------------------------------------------------------------- *

* ---------------------------------------------------------------------------- *
* End of copied code.
* ---------------------------------------------------------------------------- *

* ---------------------------------------------------------------------------- *
* Start of copied code.
* ---------------------------------------------------------------------------- *
* ---------------------------------------------------------------------------- *
* End of copied code.
* ---------------------------------------------------------------------------- *

Introduction

Do files

Style guide

Resources

Syntax

Control flow structures

foreach var in age income education {
    summarize `var'
}

Delimiter

Change delimiter to ";" or carriage return in a do file
#delimit ;
#delimit cr
  • pdelimit.pdf

    When a do-file begins, the delimiter is a carriage return. The command #delimit ; changes the delimiter to a semicolon. To restore the carriage return delimiter inside a file, use #delimit cr.

Programs

Programming Stata


Data types

Data manipulation

Data import

help import

Labels

help label

Data frames

help frames intro
help frames
frames reset
frame create <frame_name>
frame change <frame_name>
frames dir
frame
frlink 1:1 <varlist1>, frame(<frame_name> [<varlist2>])
fralias add <varlist>, from(<link_name>)
frget <varlist>, from(<link_name>)

Ado-files