Changelog
Source:NEWS.md
Statamarkdown 1.1.0
-
purl_stata()now writes each chunk’s header in the*%% label, options ----form which knitr uses when it tangles a script in another language, instead of its own* ---- label ----form, so a do-file written bypurl_stata()and one tangled byknitr::purl()look the same. The engine is dropped from the header, since the do-file implies it. -
purl_stata()now usesknitr::partition_chunk()to split a chunk’s option comments from its code, so they are recognised and parsed exactly as knitr does when the document is knitted:*|comments in astatachunk and#|comments in a chunk using the olderengine='stata'form. Values such aspurl: noare therefore understood, and a//|line, which knitr does not treat as an option comment, is now kept as (Stata comment) code instead of being dropped. -
spinstata()no longer needsengine='stata'in the chunk headers of a “do” file: code in a chunk is taken to be Stata code unless it is marked as R code with the/*R ... R*/markup, or the chunk header sets anengineoption itself. With knitr >= 1.53, Stata is also used for code which is not preceded by a chunk header at all, in a document which has no chunks of R code. -
spinstata()now callsknitr::spin()directly, instead of the modified copy of it which the package had carried since knitr 1.22. The copy was needed becausespin()could not handle a script which is not valid R code, which was fixed in knitr 1.46 (yihui/knitr#1773). As a resultspinstata()gains the featuresspin()has since acquired, including theformat = "qmd"output format and the# %%and#|chunk delimiters, and the package now requires knitr >= 1.46. -
find_stata(message = FALSE)is now silent when no Stata executable is found; previously the “No Stata executable found.” message was printed whatever the value ofmessage. The help file examples use this, so the reference pages of the pkgdown site, which is built without Stata, no longer end with that message.
Statamarkdown 1.0.0
CRAN release: 2026-08-21
- Rendering several documents in one R session now works: knitr restores the chunk options and knit hooks after each document, which left the second document without the Stata executable path (failing with “error in running command”) and without the
collectcodehook. The engine now falls back to the executable located when the package was attached, and re-registers the hook, so it is no longer necessary todetach("package:Statamarkdown")between documents. - New chunk option
stata.fig=TRUE: exports the graph drawn by a Stata chunk and includes it in the output document. The figure goes through knitr’s standard plot machinery, sofig.cap,fig.alt(alternative text, for accessibility),out.width,out.height,fig.align,fig.linkandfig.pathall work as for R chunks. The export format is set withstata.fig.format(default"svg", which Stata batch mode supports on all platforms). In Rmd and Quarto documents the hyphenated spellingsstata-figandstata-fig-formatare also accepted when using YAML style chunk options. (thanks @kylebutts in #28) - New function
purl_stata(), the Stata analogue ofknitr::purl(): extracts the code from the Stata chunks of an R Markdown or Quarto document into a do-file, recording each chunk’s header (label and options) as a Stata comment, and followingknitr::purl()’sdocumentationlevels (2also carries the document text over as Stata comments). Chunks withpurl=FALSEoreval=FALSEare skipped, including via option comments in any of the forms knitr accepts in Stata chunks (#|,*|,//|). (thanks @davidaarmstrong in #39) - Fixed the
collectcodechunk option when knitr evaluates chunks in a different directory to the document, for example for a document in a subfolder of an RStudio project with the “Evaluate chunks in directory: Project” option set, or when knitting withrmarkdown::render(knit_root_dir=). The temporaryprofile.dois now created, and any pre-existingprofile.dosnapshot and restored, in the directory where the chunks (and therefore Stata) run. (thanks @DaniMori in #17) - Switch from including the html docs files to including them within the package as precomputed vignettes using Quarto.
- Tweak helpfile examples such that they run within RStudio.
- Add markdown to Suggests dependencies because it is needed for a code path within spinstata (in fact the one in that helpfile).
- Guard two of the helpfile examples for the presence of the rmarkdown package.
- Only activate nocommands, nooutput and quietly when set to
TRUE - Add some tests
- Convert documentation to use roxygen2
Statamarkdown 0.9.7
CRAN release: 2026-07-19
- Fixed loss of all chunk output when the Stata log does not contain an “end of do-file” line.
-
spinstata()no longer overwrites its input file; astatafilewithout a.doextension is now an error, and the extension check is case-insensitive. - Fixed a crash in the
collectcodechunk option whenengine.pathis given as a plain string rather than a list. - The cleanup of the temporary
profile.docreated bycollectcodenow locates theknitr::knit()call on the call stack instead of assuming a hardcoded stack depth, making it robust to changes in knitr’s internals, child documents, and different ways of invoking knitr. -
cleanlog=TRUEnow removes all lines of multi-line loop commands and wrapped (continued) command lines from the output. -
cleanlog=TRUEno longer deletes genuine output lines that begin with a decimal point. - Fixed
spinstata()block tracking when a marked-up block starts and ends on the same line. - Fixed an error in
spinstata()on R >= 4.3 when producingRnworRtexoutput. -
find_stata()on Windows now stops searching as soon as an executable is found, and the non-existent “StataNow19” directory stub has been removed from the search. - Removed a duplicated “No Stata executable found” startup message when attaching the package without Stata installed.
- Minor performance improvements: the Stata executable is located once at package load, and per-chunk processing avoids repeated system calls and redundant vector allocations.
- Change of maintainer to Tom Palmer. Many thanks to Doug Hemken for creating and maintaining this amazing package.
- Add the precomputed vignettes to the distributed CRAN package
Statamarkdown 0.9.6
CRAN release: 2025-10-07
-
find_stata()now searches/Applications/StataNowon macOS, the StataNow directories on Windows, and two additional installation directories on Linux. - Fixed bugs in the Windows directory search.
- Fixed help file cross-reference links for the new CRAN standard.
Statamarkdown 0.9.4
CRAN release: 2025-08-23
- Updated
find_stata()for Stata 19 and the SSCC installation path.
Statamarkdown 0.9.3
- GitHub-only release, not published on CRAN.
- Updated
find_stata()for Stata 19.
Statamarkdown 0.9.2
CRAN release: 2023-12-04
- Cleaner Stata log output, and the log cleanup now accounts for unset chunk options.
- Fixed the
collectcodechunk option for knitr >= 1.45. - Package setup switched from
.onAttach()to.onLoad(). - Cleaned up package dependencies and other CRAN submission issues.
Statamarkdown 0.8.0
CRAN release: 2023-06-01
- Thoroughly reworked engine output processing and package loading.
- Edited the vignettes.
Statamarkdown 0.7.4
CRAN release: 2023-05-25
- Fixed handling of Stata executable paths containing spaces on macOS and Unix.
- Updated the required knitr version.
Statamarkdown 0.7.3
- GitHub-only release, not published on CRAN.
- Updated
find_stata()for Stata 18. - Improved the help file examples, in particular for
spinstata(). - Changed the vignette rendering, and pointed the README to CRAN.
Statamarkdown 0.7.2
CRAN release: 2023-02-15
- Better removal of the “Running …/profile.do” line from the log for long installation paths.
- Added further Unix installation paths to
find_stata(), suggested by Tom Palmer.
Statamarkdown 0.7.1
- GitHub-only release, not published on CRAN.
- Improved the
find_stata()directory search on Linux, usingSys.which().
Statamarkdown 0.7.0
- GitHub-only release, not published on CRAN.
- Updated
find_stata()for Stata 17, with macOS fixes. - Fixed a problem with factor variable names.
Statamarkdown 0.6.0
- GitHub-only release, not published on CRAN.
- Cleaned up messages in “notebook” mode.
- Fixed a macOS path problem, and added StataIC to the macOS search.
- Fixed log cleanup of the “Running …” line for Stata 16, and the
evalchunk option. - Prebuilt the vignettes for the binary version of the package.
- Added Philipp Lepert as a contributor.
Statamarkdown 0.4.4
- GitHub-only release, not published on CRAN.
- First tagged release: a knitr language engine for Stata with cleaned log output, the
collectcodechunk option for linking code blocks,spinstata()for spinning specially marked-up Stata do-files into reports, andfind_stata()to locate the Stata executable on Windows, macOS, and Linux.