Closed mengxibai closed 5 years ago
So you are trying to knit to PDF, not HTML?
I have not been able to reproduce your error, but below are some notes on how to include graphs in a PDF – in short, use the sas
engine, not the sashtml
engine.
It's not about knitting to PDF. It's the localization configuration of SAS. When using localized config for SAS, e.g nls/zh/sasv9.cfg
in this issue, the content of output and log files are also localized. So in the log file there will be no "NOTE: Writing HTML Body"
, but only "NOTE: 正在写入 HTML Body"
which causes the grep
call in 1:grep("NOTE: Writing HTML", out.log)
in sashtml.r
to return integer(0)
hence the argument of length 0
error.
One work around is changing the grep pattern to "^NOTE: ([[:alpha:]]*) HTML Body"
. Also one should add -encoding utf8
in the sas engine option if the chinese config of SAS is used.
PS: though a work around here. But the localized content also makes the sasloghook.r fails to grep and remove processing time. And the localized content cannot be easily merged into the same pattern as that of English version.
I tried to use SAS Chinese version engine sashtml to make graphics This is mycode The error will be like this . Or Can SASmarkdown attach graphics on pdf file directly? when I use SAS Chinese version engine sas pdf, It will give me a PNG file for graphics.