
Recover a .smcl file's Stata syntax as a sibling .do file
Source:R/stata.R
dot-smcl_export_syntax.RdA .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).