1 #+OPTIONS: H:3 num:nil toc:2 \n:nil ::t |:t ^:{} -:t f:t *:t tex:t d:(HIDE) tags:not-in-toc
2 #+STARTUP: align fold nodlcheck hidestars oddeven lognotestate hideblocks
3 #+SEQ_TODO: TODO(t) INPROGRESS(i) WAITING(w@) | DONE(d) CANCELED(c@)
4 #+TAGS: Write(w) Update(u) Fix(f) Check(c) noexport(n)
5 #+TITLE: Stata Source Code Blocks in Org Mode
7 #+EMAIL: istazahn@gmail.com
9 #+HTML_LINK_UP: index.html
10 #+HTML_LINK_HOME: https://orgmode.org/worg/
11 #+EXCLUDE_TAGS: noexport
15 <div id="subtitle" style="float: center; text-align: center;">
17 Org Mode support for <a href="http://stata.com">Stata</a>
22 * Template Checklist [10/12] :noexport:
24 - [X] Indicate #+AUTHOR:
26 - [-] Revise banner source block [2/3]
27 - [X] Add link to a useful language web site
28 - [X] Replace "Language" with language name
29 - [ ] Find a suitable graphic and use it to link to the language
31 - [X] Write an [[Introduction]]
32 - [X] Describe [[Requirements and Setup][Requirements and Setup]]
33 - [X] Replace "Language" with language name in [[Org Mode Features for Language Source Code Blocks][Org Mode Features for Language Source Code Blocks]]
34 - [X] Describe [[Header Arguments][Header Arguments]]
35 - [X] Describe support for [[Sessions]]
36 - [X] Describe [[Result Types][Result Types]]
37 - [ ] Describe [[Other]] differences from supported languages
38 - [X] Provide brief [[Examples of Use][Examples of Use]]
40 Stata is a proprietary statistics program popular in economics and some social sciences. Stata code blocks are partially supported in Org Mode. Basic code evaluation works, but there is no support for graphics or other more advanced org-babel features.
41 * Requirements and Setup
42 Stata source code blocks in Org Mode requires a working Stata installation, as well as the [[http://ess.r-project.org][ESS]] emacs package. Before configuring Org Mode to evaluate Stata source code blocks you should make sure that ESS is configured correctly, and that you can evaluate Stata code in ESS.
44 To configure your emacs org-mode to use Stata, you'll need to ensure
45 that =org-babel-load-languages= includes an entry for it.
46 Typically, =org-babel-load-languages= will contain many entries. The
47 example below omits other languages.
49 #+begin_src emacs-lisp :tangle yes
50 (org-babel-do-load-languages
51 'org-babel-load-languages
55 * Org Mode Features for Stata Source Code Blocks
57 Stata code evaluation currently only works with the header argument =:results output=; this is the default setting for stata code blocks.
59 Session mode is supported in stata, including named sessions.
61 Only =output= is supported.
65 #+BEGIN_SRC stata :session *Stata* :eval no :exports both
74 #+BEGIN_SRC stata :session *Stata* :eval no :exports both
82 (1978 Automobile Data)
85 Source | SS df MS Number of obs = 74
86 -------------+------------------------------ F( 1, 72) = 20.26
87 Model | 536.541807 1 536.541807 Prob > F = 0.0000
88 Residual | 1906.91765 72 26.4849674 R-squared = 0.2196
89 -------------+------------------------------ Adj R-squared = 0.2087
90 Total | 2443.45946 73 33.4720474 Root MSE = 5.1464
92 ------------------------------------------------------------------------------
93 mpg | Coef. Std. Err. t P>|t| [95% Conf. Interval]
94 -------------+----------------------------------------------------------------
95 price | -.0009192 .0002042 -4.50 0.000 -.0013263 -.0005121
96 _cons | 26.96417 1.393952 19.34 0.000 24.18538 29.74297
97 ------------------------------------------------------------------------------