The markstat command lets you combine Stata code with Markdown annotations to produce dynamic documents in HTML, PDF or DOCX format. |
Use Stata's code editor to write a script like
fuel.stmd
above center, and then run markstat using fuel
to produce the web page on the left. Add the pdf
option to produce the PDF document on the top right. Or use the docx
option to produce the Word document on the bottom right, also discussed here. All from the same script! Requires Stata 14. A comparison with the new tools in Stata 15 is here. New: R code, see example here. All you do is begin the document with three lines that start with a% symbol and contain the relevant information:% Stata Markdown% Your Name Here%.
The markstat command also lets you combine Stata code with Markdown annotations to produce dynamic presentations in HTML or PDF format. |
Use Stata's code editor to write a script like
deck.stmd
on the left, run markstat using deck, slides(santiago)
to produce an HTML presentation using S5 with the Santiago theme, as shown on the second slide on the top right. (The first slide shows the default Spiral theme.) Alternatively, change the option to beamer(madrid)
to generate a PDF slide show using Beamer with the Madrid theme (or any of many available), as shown on the second slide on the bottom right. (The first slide shows the default Beamer theme.) More on slides here.Getting Started | Documentation | Examples |
- Stata Markdown Princeton University. Stata Markdown Getting Started Getting Started. To get started we need a couple of commands and some external tools. The markstat command is available from the Statistical Software Components (SSC) archive. To install from net-aware Stata type.
- Stata's commands for creating reports come in two varieties: Dynamic document commands; These commands create text files, HTML files, and Word documents that incorporate the full output from Stata commands. You can use the Markdown text-formatting language to customize the look of your report.
- Stata processes the Markdown text and Stata dynamic tags (seeRPT Dynamic tags) and creates the output file. Markdown is a simple markup language with a formatting syntax based on plain text. It is easily converted to an output format such as HTML. Stata dynamic tags allow Stata commands, output, and graphs to be interleaved with Markdown text.
Improved Stata Editor for macOS : a sublime text 3 plugin
Stata Markdown Examples
Details
Installs
- Total2K
- Win0
- Mac2K
- Linux0
Apr 23 | Apr 22 | Apr 21 | Apr 20 | Apr 19 | Apr 18 | Apr 17 | Apr 16 | Apr 15 | Apr 14 | Apr 13 | Apr 12 | Apr 11 | Apr 10 | Apr 9 | Apr 8 | Apr 7 | Apr 6 | Apr 5 | Apr 4 | Apr 3 | Apr 2 | Apr 1 | Mar 31 | Mar 30 | Mar 29 | Mar 28 | Mar 27 | Mar 26 | Mar 25 | Mar 24 | Mar 23 | Mar 22 | Mar 21 | Mar 20 | Mar 19 | Mar 18 | Mar 17 | Mar 16 | Mar 15 | Mar 14 | Mar 13 | Mar 12 | Mar 11 | Mar 10 | Mar 9 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Mac | 1 | 1 | 0 | 3 | 1 | 2 | 1 | 1 | 11 | 3 | 0 | 2 | 1 | 1 | 1 | 2 | 2 | 3 | 2 | 1 | 4 | 6 | 2 | 0 | 1 | 3 | 0 | 5 | 6 | 1 | 4 | 4 | 1 | 0 | 4 | 0 | 4 | 5 | 2 | 2 | 0 | 2 | 1 | 1 | 3 | 1 |
Linux | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Readme
- Source
- raw.githubusercontent.com
The Sublime Text 3 (ST3) is probably the most popular text editor under the macOS platform. This plugin (v.1.3.9) is committed to making the ST3 to be the favourable and handy Stata do-file editor for Mac users.
- This package has been accepted by the Sublime Text package manager on 16th Jan 2017.
- Last edited on 12th Sep 2020 by Zizhong Yan. Comments are welcome.
? News ?
v1.3.9 (12/Sep/20): Full support for macOS Catalina & Stata 13, 14, 15 and 16 SE/MP/IC.
v1.3.7 (01/Aug/19): Full support for Stata 13, 14, 15 and 16 SE/MP/IC.
v1.3.4 (28/May/18): Some minor corrections. Also thanks for WildGunman's suggestion on the package config directories.
v1.3.3 (12/Aug/17): CTRL+r can run the code quietly in Stata (as opposed to do it noisily by CTRL+d). Thanks a lot for Andrea Discacciati's suggestions.
v1.3.1 (05/Aug/17): Stata 15 introduced the Markdown Document feature which allow users to convert their narrative text, code and outputs into a elegantly formatted document (e.g. Word, PDF, or HTML files). In this update, we provide the snippests and syntax highlighting for users to code the Stata markdown script efficiently (Many thanks for PJ Paul's suggestions). Please click here to see how to use it.
v1.3.0 (04/Aug/17): Full support for Stata 13, 14 and 15 SE/MP/IC.
v1.1.2 (08/Jun/17): The shortcut CTRL+SHIFT+d can also be used to execute the WHOLE do-file if no Matlab-style code blocks are defined. Many thanks for Alvaro Carril's suggestion on this!
v1.1.0 (14/Feb/17): We fixed the ctrl+d problem for users installed via package control!
? Main Features
1, Execute the selected do-file
2, Split the do-file into cells, and execute a block of do-file (just like what you do in Matlab) !!
3, Automated way to write Comments toggle, create a Fancy Section Header, and a To Do List.
4, Automatic template for i) writting common used commands, ii) for loops, iii) writing program.(We are updating/incorprating more templates/snippets for Stata commands.)
5, Select any word, press `, it will become 'word'.
6, Select any word, press $, it will become ${word}.
7, Select any word, press cmd+/, it will become /* word */.
8, Select any command, press F1 to see its help file.
9, Select any variable(s), press F2 to see the data browser.
10, Press F5, insert the current date and time in the code.
11, Stata and MATA Syntax-highlighting
12, Stata 15 Markdown Document support.
? Installations
Firstly you need to install the Sublime Text 3 (ST3).
Installation via packge control. (easiest and recommended?)
The installation is very simple as this package has been accepted by the Sublime Text package manager. There are 3 steps:
- Open the ST3, from the main application menu, navigate to
Tools
, open theCommand Palette
(shortcut: CMD+SHIFT+P) - Select
Package Control: Install Package
- Search
Stata Improved Editor
and hit Enter to complete installation.
If you could not find the package control in your ST3, you will need to install it in advance. To install it, please go to this webpage.
Note that though the trial version of the ST3 is untimed and unlimited, the license need be purchased.
Manual installation
Open the ST3, click the Preferences-> Browse Packages-> Then you will reach the folder
~/Library/Application Support/Sublime Text 3/Packages
. Download this Stata plugin from here, and unpack the zip fil into that folder, and rename it as “Stata Improved Editor”. ? Usage
?Code Execution
CTRL+d – Execute (do) selected codes. As opposite to “do” the code by CTRL+d, CTRL+r can “run” the code quietly in Stata.
Disk manager mac. Note that if no code is selected, the current line of the code will be sent to Stata.
?Matlab Style Execution for a Block
Say, you have the following do-file:
1) The “break line” can be simply inserted by CTRL+s .
2) Put the cursor within a block, click CTRL+SHIFT+d to execute this block.
?Run the whole do-file (NEW)
If there is no code blocks are defined by the aforementioned “break line”, clicking CTRL+SHIFT+d could execute the whole script.
?Section Header, Comments toggle, and To Do List.
Type
comm-s
, you will have a section header:? you might also try
comm-subsec
to trigger a sub-section header.Type
comm-l
, you will insert a line of comments:Type
comm-t
, you will insert to do list:Markdown In Stata
Remember to press TAB to fill up these templates!!!
?For loops template
Type
for..
, you will trigger a auto-completed for loop template, such as:Remember to press TAB to fill up this template.
?Write a program
Type
prog..
, you will trigger:Press TAB define the name of the program.
?Commands auto-completion
We are updating/incorprating more templates/snippets for Stata commands. Windows 2016 edge browser.
Stata Markdown Program
Current, there are a few auto-completions. For instance, when type
merge
, you will triggerAgain, press TAB to fill up this template.
?Macros - Local and Global
Select any word, press ` to make it as 'word'.
Select any word, press
$
to make it as ${word}. ?New: If you did not select any word but put the cursor in a word, then pressing
CMD+
` can also make it as 'word'.?Toggle comments
Select any word, press CMD +/
Markdoc
?Help File
Select any command, press F1 to see the help file.
?Data Browser
Select any variable(s), press F2 to see the data browser.
?DEMO (YouTube)
Multiple Instances of Stata
If you openned multiple instances of Stata, please note that this plugin will send the code to your MOST RECENTLY OPENNED Stata session.
If different versions of Stata are installed in your Mac (e.g. both Stata 14 and Stata 15), the plugin will send code to the most updated version of Stata (i.e. Stata 15).
Background information:
1, This plugin is motivated by the article “Some notes on text editors for Stata users” By Nicolas J. Cox, and some part of the code is motivated and modified based on following packages: StataEditor for the auto-completion, and StataEnhanced by Andrew Heiss for the AppleScript.).
This plugin basically creates a temporary do-file, which is then sent to the Stata to execute. All temporary cache files will be removed shortly when you close the Stata session.
2, This package is the Mac only. For Windows users, please follow the instructions in the Nicolas J. Cox's webpage above.
3, This plugin has been tested on Mac OS X Yosemite, El Capitan and macOS, and supports Stata 13, 14, 15 and 16 SE/MP/IC.
License
MIT License
Copyright © 2016-2021 Zizhong Yan & Chuhong Wang
Permission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the “Software”), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THESOFTWARE.