12

i wonder if there is a equivalent of R Markdown in SAS? Or how to do so in SAS? I want to have colored SAS code and its result below.

link to R Markdown: http://rstudio.org/docs/authoring/using_markdown

Yihui Xie
  • 28,913
  • 23
  • 193
  • 419
Maciej
  • 3,255
  • 1
  • 28
  • 43
  • 10
    Just do it in R. You know you want to ;-) – Andrie Jul 23 '12 at 08:46
  • +1 on using R. But I can understand that there might be circumstances where SAS is required, e.g. by the customer. – Paul Hiemstra Jul 23 '12 at 08:51
  • But if i want to do training materials for SAS i need to use SAS :) it would be better to have something similar for SAS. – Maciej Jul 23 '12 at 09:01
  • I think it is entirely possible to run SAS with `knitr` + markdown if you can define a proper language engine: http://yihui.name/knitr/demo/engines/ although it sounds ironic... Just note `knitr` is not restricted to R only; in theory you can use any languages as long as you know how to call them through R. – Yihui Xie Jul 23 '12 at 15:11
  • 3
    Though it is not what you asked for, there is something akin for LaTeX and SAS: SASweave. http://homepage.cs.uiowa.edu/~rlenth/SASweave/ Perhaps the infrastructure could be adapted to output Markdown instead of LaTeX. – Brian Diggs Jul 23 '12 at 15:56
  • I've struggled with this, but found that using pandoc and using SQL language highlighting covered most functions (but then again, I use proc SQL mostly!). To specify the language of a code block use ```{.SQL}. – mnel Jul 24 '12 at 02:32
  • There is a StatRep package for Latex http://support.sas.com/resources/papers/proceedings12/324-2012.pdf but it's still what i wanted to achieve...(thans to Cynthia from SAS https://communities.sas.com/message/132901#132901) – Maciej Jul 24 '12 at 15:59
  • It might be a bit much to expect your students to learn Emacs, but there's excellent support for literate SAS programming through the combination of [org babel](https://orgmode.org/worg/org-contrib/babel/) (the literate programming part) and [Emacs Speaks Statistics](http://ess.r-project.org/Manual/ess.html#ESS-for-SAS) (the SAS part). – anon Nov 16 '18 at 03:25

2 Answers2

4

Geshi supports SAS. I think it does a pretty nice job. It is the highlighter in Wikimedia and is also available as a Perl module.

It shouldn't be too hard (famous last words :)) to connect Geshi to Markdown. You could obtain the plots by running a console SAS job. However, I think that as of 2012 (SAS 9.3), you would have to automate the workflow yourself. When one of the markup languages becomes dominant you will probably see more formal support.

Leo
  • 2,775
  • 27
  • 29
0

This link describes how to generate reports using SAS. From skimming the pdf it seems that you can integrate SAS analyses and text:

With SAS procedures, SAS DATA steps, and SAS features such as the Output Delivery System (ODS) and the macro facility, you have the tools to succeed at writing programs that analyze your data and create reports

Paul Hiemstra
  • 59,984
  • 12
  • 142
  • 149