Closed ewancarr closed 9 years ago
text_2_stata.py strips line continuation syntax (i.e. /// followed by \n) from commands before sending to Stata. This is in line 17-18:
text_2_stata.py
///
\n
# Take care of line continuation clean = re.sub("/{3,}\\n", "", clean)
However, if there are no spaces between this command and the next line, the resulting syntax will be invalid. For example, the following Stata code:
cap label drop ses4 label define ses4 /// 1 "Professional" /// 2 "Intermediate" /// 3 "Non-manual" /// 4 "Manual/other" label values ses4 ses4
Will be appear in Stata as:
. label define ses41 "Professional"2 "Intermediate"3 "Non-manual"4 "Manual/other" invalid syntax r(198);
This is an error, because ses4 and 1 have been concatenated.
ses4
1
To fix this, I edited text_2_stata.py such that line continuation marks are replaced by a single space:
clean = re.sub("/{3,}\\n", " ", clean)
This seems to work.
Thanks!
text_2_stata.py
strips line continuation syntax (i.e.///
followed by\n
) from commands before sending to Stata. This is in line 17-18:However, if there are no spaces between this command and the next line, the resulting syntax will be invalid. For example, the following Stata code:
Will be appear in Stata as:
This is an error, because
ses4
and1
have been concatenated.To fix this, I edited
text_2_stata.py
such that line continuation marks are replaced by a single space:This seems to work.