[["stata-and-r-markdown.html", "Using Statamarkdown 1 Stata and R Markdown 1.1 Introduction 1.2 Background 1.3 Install Statamarkdown 1.4 Set up the Stata engine 1.5 Link Code Blocks 1.6 Hints and Examples", " Using Statamarkdown Doug Hemken 2022-03-02 1 Stata and R Markdown 1.1 Introduction This is an introduction to writing dynamic documents using R Markdown to produce documents based on Stata. This process uses Rstudio (or just R) to create documents that depend upon Stata code. 1.2 Background Markdown is a language for formatting not-too-complicated documents using just a few text symbols. It is designed to be easy to read and write. If you read and write email, you are probably already familiar with many of these formatting conventions. For more specifics about Markdown see John Gruber's Markdown article. Dynamic Markdown has been implemented for a number of programming languages, including Stata and R. Within Stata there is a dynamic markdown package called stmd that relies on Stata's dyndoc command, as well as the user-written package markstat. Each has it's strengths and weaknesses. The system I will describe here is intended primarily for those of us who are already using R Markdown to write documentation in other languages, and would like to use this for Stata as well. R Markdown is a dynamic markdown system that extends Markdown by allowing you to include blocks of code in one of several programming languages. The code is evaluated, and both the code and it's results are included in a Markdown document. To read more about the details of R Markdown see RStudio's R Markdown webpages RStudio uses an R package called knitr (this could also be called directly from R), which includes the ability to evaluate Stata. The documentation for knitr can be found in R's Help, from Yihui Xie's web page, or in the book, R Markdown: The Definitive Guide. Finally, I use some helper functions in a package called Statamarkdown. While these are not necessary to write dynamic documents based on Stata, they make life easier. 1.3 Install Statamarkdown Statamarkdown can be installed from github.com. (See section 2, Installing Statamarkdown, for more installation options.) library(devtools) # you may also need to install devtools install_github("hemken/Statamarkdown") Note, RStudio is a great environment for writing Markdown with executable R code chunks, but it is not a friendly environment for extensively debugging problems in your Stata code. If your Stata code is complicated, you should probably work out the details in Stata first, then pull it into RStudio to develop your documentation! 1.4 Set up the Stata engine In order to execute your Stata code, knitr needs to know where the Stata executable is located. This can be done with a preliminary code chunk, by loading the Statamarkdown package: ```{r, echo=FALSE, message=FALSE} library(Statamarkdown) ``` (In knitr jargon, a block of code is a \"code chunk\".) If the package fails to find your copy of Stata (you will see a message), you may have to specify this yourself (see section 3, Stata Engine Path, for more details). After this setup chunk, subsequent code to be processed by Stata can be specified as: ```{stata} -- Stata code here -- ``` 1.5 Link Code Blocks Each block (chunk) of Stata code is executed as a separate batch job. This means that as you move from code chunk to code chunk, all your previous work is lost. To retain data from code chunk to code chunk requires collecting (some of) your code and processing it silently at the beginning of each subsequent chunk. You can have knitr collect code for you, as outlined in section 4.1, Linking Stata Code Blocks, and as illustrated below. 1.6 Hints and Examples 1.6.1 Code Separate or with Output Stata does not give you fine control over what ends up in the .log file. You can decide whether to present code and output separately (R style), or include the code in the output (Stata style). See section 5, Stata Output and cleanlog. 1.6.2 Including Graphs Including graphics requires graph export in Stata, and an image link in the R Markdown. The knitr chunk option echo can print just specified lines of code, allowing you to hide the graph export command as illustrated below. 1.6.3 Descriptive Statistics A simple example. ```{stata, collectcode=TRUE} sysuse auto summarize ``` sysuse auto summarize Variable | Obs Mean Std. dev. Min Max -------------+--------------------------------------------------------- make | 0 price | 74 6165.257 2949.496 3291 15906 mpg | 74 21.2973 5.785503 12 41 rep78 | 69 3.405797 .9899323 1 5 headroom | 74 2.993243 .8459948 1.5 5 -------------+--------------------------------------------------------- trunk | 74 13.75676 4.277404 5 23 weight | 74 3019.459 777.1936 1760 4840 length | 74 187.9324 22.26634 142 233 turn | 74 39.64865 4.399354 31 51 displacement | 74 197.2973 91.83722 79 425 -------------+--------------------------------------------------------- gear_ratio | 74 3.014865 .4562871 2.19 3.89 foreign | 74 .2972973 .4601885 0 1 1.6.4 Frequency Tables Using chunk options echo=FALSE, cleanlog=FALSE, yields a more typical Stata documentation style. ```{stata, echo=FALSE, cleanlog=FALSE} tab1 foreign rep78 ``` . tab1 foreign rep78 -> tabulation of foreign Car origin | Freq. Percent Cum. ------------+----------------------------------- Domestic | 52 70.27 70.27 Foreign | 22 29.73 100.00 ------------+----------------------------------- Total | 74 100.00 -> tabulation of rep78 Repair | record 1978 | Freq. Percent Cum. ------------+----------------------------------- 1 | 2 2.90 2.90 2 | 8 11.59 14.49 3 | 30 43.48 57.97 4 | 18 26.09 84.06 5 | 11 15.94 100.00 ------------+----------------------------------- Total | 69 100.00 1.6.5 T-tests Another very simple example. ttest mpg, by(foreign) Two-sample t test with equal variances ------------------------------------------------------------------------------ Group | Obs Mean Std. err. Std. dev. [95% conf. interval] ---------+-------------------------------------------------------------------- Domestic | 52 19.82692 .657777 4.743297 18.50638 21.14747 Foreign | 22 24.77273 1.40951 6.611187 21.84149 27.70396 ---------+-------------------------------------------------------------------- Combined | 74 21.2973 .6725511 5.785503 19.9569 22.63769 ---------+-------------------------------------------------------------------- diff | -4.945804 1.362162 -7.661225 -2.230384 ------------------------------------------------------------------------------ diff = mean(Domestic) - mean(Foreign) t = -3.6308 H0: diff = 0 Degrees of freedom = 72 Ha: diff < 0 Ha: diff != 0 Ha: diff > 0 Pr(T < t) = 0.0003 Pr(|T| > |t|) = 0.0005 Pr(T > t) = 0.9997 1.6.6 Graphics The example uses the knitr chunk options results=\"hide\" to suppress the log and echo=1 to show only the Stata graph box command that users need to see. ```{stata, echo=1, results="hide"} graph box mpg, over(foreign) graph export "boxplot.svg", replace ``` graph box mpg, over(foreign) Example boxplot (This page was written using Statamarkdown version 0.7.1.) "],["installing-statamarkdown.html", "2 Installing Statamarkdown", " 2 Installing Statamarkdown This package gives you a little more control over Stata execution and the inclusion of Stata output in your document than the engine I originally wrote for knitr. Most knitr users won't need this capability, so I've put it in this separate package. Statamarkdown can be installed from github.com by using the remotes or devtools package. Installing Statamarkdown from GitHub is guaranteed to be my latest version. library(remotes) # you may need to install the remotes package install_github("hemken/Statamarkdown") If for some reason that gives you problems, you can also install from this website. # For Windows install.packages("https://www.ssc.wisc.edu/~hemken/Stataworkshops/Statamarkdown/Statamarkdown_0.7.0.zip", repos=NULL) # For linux or Mac install.packages("https://www.ssc.wisc.edu/~hemken/Stataworkshops/Statamarkdown/Statamarkdown_0.7.0.tar.gz", type="source", repos=NULL) (This page was written using Statamarkdown version 0.7.1.) "],["stata-engine-path.html", "3 Stata Engine Path 3.1 Introduction 3.2 Loading Statamarkdown 3.3 Finding the Stata program 3.4 Loading Statamarkdown (again) 3.5 Example", " 3 Stata Engine Path 3.1 Introduction In order to put together dynamic documents (Markdown) that process Stata code from within R or RStudio, the knitr function needs the location of Stata's executable (the program or app file).This is not something most of us usually think about. 3.2 Loading Statamarkdown In a preliminary code block in your document, load the Statamarkdown package. In addition to loading the Statamarkdown package, you may need to specify the location of the Stata executable. An attempt has been made to automate this for recent versions of Stata (>= Stata 11) that are installed in the default location. If Stata is found successfully, you will see a message (or messages) like library(Statamarkdown) (If you have more than one version of Stata installed on your computer, the last one listed will be used.) If Statamarkdown fails to find your Stata program, you will see the message No Stata executable found. 3.3 Finding the Stata program If you need to give this location yourself, an easy way to figure it out is to ask your Stata software! Start up Stata (this requires an interactive Stata session), and in your Stata session (not in your document!) issue the command sysdir For a typical Windows installation, the results would similar to this: STATA: C:\\Program Files\\Stata17\\ BASE: C:\\Program Files\\Stata17\\ado\\base\\ SITE: C:\\Program Files\\Stata17\\ado\\site\\ PLUS: u:\\stata\\ado\\plus\\ PERSONAL: u:\\stata\\ado\\personal\\ OLDPLACE: c:\\ado\\ The line labeled STATA: is the folder where your Stata executable is located (probably not the same as shown here). You can browse there with your computer's file explorer to see the actual file name of the Stata executable, which you need. (Notice that BASE and SITE also clue you in, if you are working in Stata batch mode.) If you are working from a linux command line, you can try > which stata 3.4 Loading Statamarkdown (again) I am usually using a 64-bit version of Stata SE, so had this not been found initially I would modify the preliminary code chunk in my document to read library(Statamarkdown) stataexe <- "C:/Program Files/Stata17/StataSE-64.exe" knitr::opts_chunk$set(engine.path=list(stata=stataexe)) Notice for Windows I have switched backslashes to forward slashes! On a Mac you might try something like stataexe <- "/Applications/Stata/StataSE.app/Contents/MacOS/StataSE" 3.5 Example And from there you are ready to execute and write about Stata code! sysuse auto summarize (1978 automobile data) Variable | Obs Mean Std. dev. Min Max -------------+--------------------------------------------------------- make | 0 price | 74 6165.257 2949.496 3291 15906 mpg | 74 21.2973 5.785503 12 41 rep78 | 69 3.405797 .9899323 1 5 headroom | 74 2.993243 .8459948 1.5 5 -------------+--------------------------------------------------------- trunk | 74 13.75676 4.277404 5 23 weight | 74 3019.459 777.1936 1760 4840 length | 74 187.9324 22.26634 142 233 turn | 74 39.64865 4.399354 31 51 displacement | 74 197.2973 91.83722 79 425 -------------+--------------------------------------------------------- gear_ratio | 74 3.014865 .4562871 2.19 3.89 foreign | 74 .2972973 .4601885 0 1 (This page was written using Statamarkdown version 0.7.1.) "],["linking-code-blocks.html", "4 Linking Code Blocks 4.1 Linking Code Blocks 4.2 An Example 4.3 The collectcode Chunk Option 4.4 Clear collectcode", " 4 Linking Code Blocks 4.1 Linking Code Blocks Most documents have alternating blocks of code, output, and explanatory text. And very often the code illustrated in later blocks will depend in some way on code in the previous blocks. However, each code block (also called a \"code chunk\") is executed as a separate Stata session. For example, your first block of code might load a data set, calculate a new variable, and provide summary statistics (see below). You then provide some explanatory text that tells the reader about the analysis you are about to do, followed by the code block for the analysis and the output. Because the second, \"analysis\" code block is executed as a separate Stata session, you have to reload the data set and re-calculate the new variable. One way to have some \"setup\" code execute silently at the start of each Stata code block is to put it in a file named profile.do, located in the same folder as your Markdown file. (See the Stata FAQ about profile.do files: Stata looks for this file every time it starts up.) Statamarkdown provides a chunk option to collect your code as you go, and adds each block of code to your profile.do. (Side note: local macros defined in profile.do disappear after the profile has run. In other words, you cannot accumulate local macro definitions.) You may not want all of your code to end up in the profile.do, so the implementation here makes it a user-specified option whether or not each code block is added to the profile.do. For longer documents, try to collect as little code as possible, or it will really slow down the generation of your document! 4.2 An Example This illustrates what we would like to be able to do. A first code block: sysuse auto generate gpm = 1/mpg summarize price gpm (1978 automobile data) Variable | Obs Mean Std. dev. Min Max -------------+--------------------------------------------------------- price | 74 6165.257 2949.496 3291 15906 gpm | 74 .0501928 .0127986 .0243902 .0833333 A second, later code block: regress price gpm Source | SS df MS Number of obs = 74 -------------+---------------------------------- F(1, 72) = 35.95 Model | 211486574 1 211486574 Prob > F = 0.0000 Residual | 423578822 72 5883039.19 R-squared = 0.3330 -------------+---------------------------------- Adj R-squared = 0.3238 Total | 635065396 73 8699525.97 Root MSE = 2425.5 ------------------------------------------------------------------------------ price | Coefficient Std. err. t P>|t| [95% conf. interval] -------------+---------------------------------------------------------------- gpm | 132990 22180.86 6.00 0.000 88773.24 177206.7 _cons | -509.8827 1148.469 -0.44 0.658 -2799.314 1779.548 ------------------------------------------------------------------------------ 4.3 The collectcode Chunk Option The implementation here makes use of a \"chunk hook\", collectcode. With the Statamarkdown library loaded, this option is available for any Stata code chunk. In the example (above), I added code from the first Stata chunk (labelled \"first-Stata\") to the profile.do, but not code from the second chunk. A first code block: ```{stata first-Stata, collectcode=TRUE} sysuse auto generate gpm = 1/mpg summarize price gpm ``` A second, later code block: ```{stata second-Stata} regress price gpm ``` 4.4 Clear collectcode If you need to clear collected code partway through a document, include code in your document to delete the profile.do file. This is done automatically at the end of each document. (This page was written using Statamarkdown version 0.7.1.) "],["stata-output-and-cleanlog.html", "5 Stata Output and cleanlog 5.1 Removing Stata Code from Output 5.2 Restoring Stata Code to Output", " 5 Stata Output and cleanlog 5.1 Removing Stata Code from Output Statamarkdown removes the echoed Stata code from your Stata output by default, and echoes it in a separate block in your text before the output. 5.2 Restoring Stata Code to Output To show Stata code mixed with the Stata output (this is the style used in official Stata documentation), use chunk options cleanlog=FALSE and echo=FALSE. ```{stata official, cleanlog=FALSE, echo=FALSE} sysuse auto summarize ``` Which produces this result: . sysuse a(1978 automobile data) . summarize Variable | Obs Mean Std. dev. Min Max -------------+--------------------------------------------------------- make | 0 price | 74 6165.257 2949.496 3291 15906 mpg | 74 21.2973 5.785503 12 41 rep78 | 69 3.405797 .9899323 1 5 headroom | 74 2.993243 .8459948 1.5 5 -------------+--------------------------------------------------------- trunk | 74 13.75676 4.277404 5 23 weight | 74 3019.459 777.1936 1760 4840 length | 74 187.9324 22.26634 142 233 turn | 74 39.64865 4.399354 31 51 displacement | 74 197.2973 91.83722 79 425 -------------+--------------------------------------------------------- gear_ratio | 74 3.014865 .4562871 2.19 3.89 foreign | 74 .2972973 .4601885 0 1 (This page was written using Statamarkdown version 0.7.1.) "],["including-stata-graphs.html", "6 Including Stata Graphs 6.1 Saving a Stata Graph 6.2 Insert via Markdown 6.3 Insert SVG via R 6.4 Stata Graph Options", " 6 Including Stata Graphs Including Stata graphics in your Statamarkdown document is fairly simple, but it is not automatic. There are fundamentally two approaches you can take to include a Stata graph in your document. For both, you must first issue the Stata commands to create and save your graph. sysuse auto, clear 6.1 Saving a Stata Graph In Stata you might use two commands to create and save your graph. Use the echo=1 chunk option to show your reader only the scatter command. ```{stata scatterplot, echo=1, results="hide"} scatter mpg weight quietly graph export scatter.svg, replace ``` Your options for graphics file formats depend upon your operating system, and the version of Stata you are using. Common formats for HTML documents are png, jpg, and svg. scatter mpg weight 6.2 Insert via Markdown In Markdown, you can link to separate image files from within your document. Keep in mind that when you publish and HTML document with a linked graph file, you need to publish both files. The Markdown specification allows you to insert a graphics file in the following manner ![Mileage ~ Weight](scatter.svg) Mileage ~ Weight 6.3 Insert SVG via R SVG is a graphics format that saves information as text in a form that many programs, including web browsers recognize and render appropriately. For files of this type, the SVG code can be included directly in an HTML document. The following code chunk reads the contents of an SVG file into a Markdown document. This can be used to include graphics within you main HTML file, simplifying file management later. The R code here also deletes the graphics file after it has been used in your document. ```{r graphincl, results="asis"} cat(readLines("scatter.svg")) ``` ```{r cleanup, include=FALSE} unlink("scatter.svg") ``` Notice that this method does not give you a figure caption, nor does it center your graph on the page. cat(readLines("scatter.svg")) Stata Graph - Graph 10 20 30 40 Mileage (mpg) 2,000 3,000 4,000 5,000 Weight (lbs.) 6.4 Stata Graph Options Neither method of including a Stata graph gives you control over graph size or graph aesthetics. These are all elements that must be specified in Stata, rather than R or Statamarkdown. (This page was written using Statamarkdown version 0.7.1.) "],["inline-stata-results.html", "7 Inline Stata Results 7.1 Example 7.2 Markdown", " 7 Inline Stata Results Statamarkdown does not provide support for inline code, because knitr does not support inline code in any language other than R. While this means you cannot call Stata inline to insert results within ordinary text, for users with sufficient knowledge of both Stata and R, there is a workaround. It is not very elegant, but here goes. 7.1 Example An example of what we are aiming for is the following: sysuse auto, clear summarize price (1978 automobile data) Variable | Obs Mean Std. dev. Min Max -------------+--------------------------------------------------------- price | 74 6165.257 2949.496 3291 15906 The average price was 6165.257. 7.2 Markdown The markdown used is: ```{stata , collectcode=TRUE} sysuse auto, clear summarize price ``` ```{stata for_inline, include=FALSE} file open myfile using example.txt, write replace file write myfile `"`r(mean)'"' file close myfile ``` The average price was `r format(as.numeric(readLines('example.txt'), warn=FALSE), nsmall=2)`. ```{r cleanup, include=FALSE} unlink("example.txt") ``` The second code block, labeled \"for_inline\" is Stata code that writes the appropriate value to a file, here named \"example.txt\". The inline code, written in R, then reads the value from the file and formats it for display. The final code block, labeled \"cleanup\" then removes the file used to transfer the value. In this example it is written in R, but we could have used Stata just as well. I warned you this isn't graceful! (This page was written using Statamarkdown version 0.7.1.) "],["combining-stata-and-r.html", "8 Combining Stata and R 8.1 Introduction 8.2 Switching Languages", " 8 Combining Stata and R 8.1 Introduction One of the virtues of processing your dynamic documents through R is that you can use more than one programming language in a single document. Many of us are multi-lingual, and it is often quicker and easier to execute part of a project in one language, while completing your work in another. This is especially common when you are in the process of learning a new language, or if part of your work involves a specialized language with limited capabilities. 8.2 Switching Languages You tell knitr which language to use for each code chunk. This is specified in the code chunk header. 8.2.1 Using Stata A regression in Stata. The code chunk is ```{stata} sysuse auto regress mpg weight ``` The result of including it in your document is sysuse auto regress mpg weight (1978 automobile data) Source | SS df MS Number of obs = 74 -------------+---------------------------------- F(1, 72) = 134.62 Model | 1591.9902 1 1591.9902 Prob > F = 0.0000 Residual | 851.469256 72 11.8259619 R-squared = 0.6515 -------------+---------------------------------- Adj R-squared = 0.6467 Total | 2443.45946 73 33.4720474 Root MSE = 3.4389 ------------------------------------------------------------------------------ mpg | Coefficient Std. err. t P>|t| [95% conf. interval] -------------+---------------------------------------------------------------- weight | -.0060087 .0005179 -11.60 0.000 -.0070411 -.0049763 _cons | 39.44028 1.614003 24.44 0.000 36.22283 42.65774 ------------------------------------------------------------------------------ 8.2.2 Using R A regression in R, using very similar data! The code chunk is ```{r cars} summary(lm(mpg ~ wt, data=mtcars)) ``` The result of including it in your document is summary(lm(mpg ~ wt, data=mtcars)) Call: lm(formula = mpg ~ wt, data = mtcars) Residuals: Min 1Q Median 3Q Max -4.5432 -2.3647 -0.1252 1.4096 6.8727 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 37.2851 1.8776 19.858 < 2e-16 *** wt -5.3445 0.5591 -9.559 1.29e-10 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 3.046 on 30 degrees of freedom Multiple R-squared: 0.7528, Adjusted R-squared: 0.7446 F-statistic: 91.38 on 1 and 30 DF, p-value: 1.294e-10 (This page was written using Statamarkdown version 0.7.1.) "],["spin-stata.html", "9 Spin Stata", " 9 Spin Stata Occasionally you may wish you could take a Stata do file and knit it so that the comments were treated as Markdown. This is what spinstata is for. This function takes a Stata do file containing special mark up in it’s comments, and converts it into knitr’s “spin” format. The resulting document is in turn sent to knitr::spin, converted to Markdown, knit, and finally compiled to HTML or one of several other rmarkdown formats. In order to coexist with the Stata code in a do file, the markup distinguishing different elements of a document take the form of special Stata comments. Spin Stata Markup: /*' - Begin document text, ends with '*/ /*+ - Begin chunk header, ends with +*/ /*R - Begin a chunk of R code, ends with R*/ */* - Dropped from the document, ends with */* Ordinarily, you will begin with a Stata do file, and add comments. Suppose your plain do file looked like this: sysuse auto /* Stata comment */ summarize You embellish by adding some explanatory text, saving it again as an enhanced do file, for example as spinstata_example.do: /*' This is a Stata script (a do file) which can also be used to generate a report. You can write normal text in delimited comments. First we specify a path for Stata and set up some options. '*/ /*+ spinsetup +*/ /*R library(Statamarkdown) knitr::opts_chunk$set(comment=NA) R*/ /*' The report begins here. '*/ /*+ example1, engine='stata' +*/ sysuse auto /* Stata comment */ summarize /*' You can use the ***usual*** Markdown.'*/ Note that if you open this file in the Stata editor you can execute the Stata commands, just like any other do file. To knit the file and process the Markdown, in R issue the command: Statamarkdown::spinstata("spinstata_example.do") This would produce a document that looks like this "],["stata-help-in-markdown.html", "10 Stata Help in Markdown 10.1 Introduction 10.2 Example - help graph 10.3 The R Markdown", " 10 Stata Help in Markdown 10.1 Introduction For some Stata documentation, you may want to include portions of Stata's help files. When I present workshops on Stata programming topics, I often refer to the Help files. I use them constantly myself, and I usually want my audience to learn to do the same. I can usually just write \"look up command name\" or provide a URL. But every once in a while, I want to include something from a Help file in my own writing. Sometimes I want to make a point about how the Help itself is laid out. 10.2 Example - help graph For example, I recently found myself wanting to discuss some of the many tasks accomplished with Stata's graph command, and it is useful to look at how Stata has grouped these in its own documentation. In Stata, type the command: help graph What you will see in the Help (below) is that the first group of graph commands draw graphs, that is, they specify how the ink is to go on the page (pixels on the screen), and then carry out that task. The other graph commands, grouped further down, are utility procedures that mostly manipulate a graph that has been produced. (I have only included part of the Help page here.) [G-2] graph -- The graph command (View complete PDF manual entry) Syntax graph ... The commands that draw graphs are Command Description --------------------------------------------------------------------- graph twoway scatterplots, line plots, etc. graph matrix scatterplot matrices graph bar bar charts graph dot dot charts graph box box-and-whisker plots graph pie pie charts other more commands to draw statistical graphs --------------------------------------------------------------------- The commands that save a previously drawn graph, redisplay previously saved graphs, and combine graphs are Command Description --------------------------------------------------------------------- graph save save graph to disk graph use redisplay graph stored on disk graph display redisplay graph stored in memory graph combine combine multiple graphs graph replay redisplay graphs stored in memory and on disk --------------------------------------------------------------------- 10.3 The R Markdown There are three steps to this little display: a fake call to help graph. This is faked because it is a command Stata would ignore in batch mode. a hidden translate command (in Stata). This converts Stata's marked up (SMCL) help into plain text. a hidden readLines command (in R). This gives us our \"output\" in the document. To see the details, see the source. (This page was written using Statamarkdown version 0.7.1.) "],["default-directories-in-statamarkdown.html", "11 Default Directories in Statamarkdown 11.1 R working directory 11.2 Stata working directory", " 11 Default Directories in Statamarkdown 11.1 R working directory getwd() [1] "/home/h/hemken/R/Statamarkdown_docs" 11.2 Stata working directory This is where Stata will look for arbitrary files if no path is given. cd sysdir list /home/h/hemken STATA: /software/stata/ BASE: /software/stata/ado/base/ SITE: /software/ado/ PLUS: ~/ado/plus/ PERSONAL: ~/ado/personal/ OLDPLACE: ~/ado/ (This page was written using Statamarkdown version 0.7.1.) "],["404.html", "Page not found", " Page not found The page you requested cannot be found (perhaps it was moved or renamed). You may want to try searching to find the page's new location, or use the table of contents to find the page you are looking for. "]]