Skip to contents

A .smcl file is Stata's rendered OUTPUT log, but every command it ran is echoed verbatim (a .smcl command echo IS the exact Stata syntax, unlike .spv's syntax which is recovered from a SEPARATE structure element – see .spv_export_syntax() in R/spv.R, whose role this mirrors for code_check()). This materialises that syntax as a real .do file, in a code subdirectory alongside the original .smcl file, so it is discoverable the same way an author's own saved .do file would be – and, crucially, so it then flows through code_check()'s ordinary Stata-language analysis (comments, absolute paths, library lines) unmodified, since code_lang() already recognises .do (see .code_expand_smcl() in R/code_check.R, this function's only caller).

Usage

.smcl_export_syntax(smcl_path, code_dir_name = "code")

Arguments

smcl_path

path to the .smcl file

code_dir_name

name of the sibling code subdirectory to write into, relative to smcl_path's own directory. Default "code". A file of the user's own gets this folder in the temporary folder instead, so the user's folder is not changed (see .recovered_code_dir()).

Value

the path to the written .do file, or NA_character_ if the file has no recoverable command echoes at all.