Hemken / SASmarkdown

A collection of R functions that extends knitr's capability for using SAS as a language engine
Other
21 stars 5 forks source link

Can SAShtml work with chinese version SAS? #8

Closed mengxibai closed 5 years ago

mengxibai commented 5 years ago

I tried to use SAS Chinese version engine sashtml to make graphics This is mycode Q1 The error will be like this Q2. 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.

Hemken commented 5 years ago

So you are trying to knit to PDF, not HTML?

Hemken commented 5 years ago

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.

Hemken commented 5 years ago

pdfplots.pdf

fenguoerbian commented 2 years ago

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.