I'm wondering if anyone knows of a Latex package that can be used for placing SAS source code into a latex document, having it execute and display output in the Latex documnet similar to Sweave in R. I've seen references to SASWeave on the web, and I tried to install this on Win 64-bit, but didn't seem to have any luck. Does anyone else have any suggestions?

Thanks.

asked 28 Oct '11, 16:20

MarkLamias's gravatar image

MarkLamias ♦
839315
accept rate: 20%


I'll answer my own question after doing some rearch on this. It appears that "The SASnRdisplay package serves as a front-end to the listings, which permits statisticians and others to import source code, and the results of their calculations or simulations into LaTeX projects."

http://www.tex.ac.uk/tex-archive/help/Catalogue/entries/sasnrdisplay.html

link

answered 19 Dec '11, 04:12

MarkLamias's gravatar image

MarkLamias ♦
839315
accept rate: 20%

the listings package. it can be configured to use syntax highlighting, line numbers, put code in sweet looking boxes, et cetera.

http://en.wikibooks.org/wiki/LaTeX/Packages/Listings

link

answered 09 Dec '11, 00:25

jcress's gravatar image

jcress
3518
accept rate: 0%

jcress, have you been able to get this to work? I've seen this too, but it does not seem to work at all with SAS. Even the highlighting seems to fail.

If you have used this sucesfully, plese let me know. I'ld love to hear if other users have had any luck.

Thanks.

(14 Dec '11, 11:32) MarkLamias ♦

Try this one

\\documentclass[a4paper,article]{memoir}
\\setlrmarginsandblock{3cm}{3cm}{*}
\\setulmarginsandblock{2.5cm}{3cm}{*}
\\checkandfixthelayout[nearest]
\\usepackage[T1]{fontenc}
\\usepackage{kpfonts}
\\usepackage{xspace,calc,listings,enumitem,url,ragged2e}
\\setlist{  
  listparindent=\\parindent,
  parsep=0pt,
}
\\usepackage[scaled=0.8]{beramono}

\\hfuzz=5pt

%\\setlength\\cftbeforechapterskip{0em plus 0.2em}

\\AtBeginDocument{\\providecommand\\href[2]{#2}}

\\DeclareUrlCommand\\mypath{\\urlstyle{sf}}
%\\urlstyle{rm}
\\newcommand\\addCTAN[2][\\textsf{CTAN}:]{%
    {\\footnotesize\\href{http://mirror.ctan.org/#2}{#1\\:{\\mypath{#2}}}}% 
}

\\newcommand\\CTAN[1]{%
  {\\footnotesize\\href{http://mirror.ctan.org/#1}{\\textsf{CTAN:}~{\\mypath{#1}}}}}

\\newcommand\\pkg{\\texttt{SASnRdisplay}\\xspace}
%\\setsecnumdepth{none}
\\setsecheadstyle{\\large\\slshape\\bfseries\\memRTLraggedright}

\\usepackage[svgnames,dvipsnames]{xcolor}
 \\definecolor{felinesrcbgcolor}{rgb}{0.94,0.97,1}
 \\definecolor{felineframe}{rgb}{0.79,0.88,1}

\\usepackage[
english,
%grayscale,
%noautotitles-sas,
noneedspace
]{SASnRdisplay}

\\captionsetup[lstlisting]{
  font=small,
  labelfont=bf
}

\\newcommand\\R{\\textsf{R}\\xspace}
\\newcommand\\SAS{\\textsf{SAS}\\xspace}
\\newcommand\\sweave{\\textsf{Sweave}\\xspace}

\\usepackage{xkeyval}

\\setlength\\unitlength{\\linewidth+1em}
\\lstdefinestyle{Show}{
  basicstyle=\\ttfamily\\small,
  breaklines,
  breakatwhitespace,
  columns=flexible,
  backgroundcolor=\\color{BrickRed!10},
  rulecolor=\\color{BrickRed},
  frame=single,
  framesep=0.25em,
  escapeinside=||,
}
\\lstdefinestyle{inShow}{
  style=Show,
  basicstyle=\\ttfamily\\normalsize\\color{BrickRed},
}
\\lstnewenvironment{Show}[1][]{
\\lstset{
  style=Show,#1
}
}{}
%\\setsecnumdepth{none}
\\newcommand\\error[1]{\\textcolor{OliveGreen}{>>#1<<}}

\\def\\NAME{SASnRdisplay.sty}
\\newcommand\\getsniplet[2]{
  \\begingroup
  \\Needspace{4\\onelineskip}
  \\ifblank{#2}{
    \\lstinputlisting[style=Show,
    rangeprefix=\\%\\ ,
    includerangemarker=false,
    linerange=#1-end\\ #1,
    columns=fixed,
    xleftmargin=0.5em,
    framexleftmargin=0.5em,
    ]{\\NAME}
  }{
    \\lstinputlisting[style=Show,
    rangeprefix=\\%\\ ,
    includerangemarker=false,
    linerange=#1-end\\ #1,
    title={Style: #2},
    columns=fixed,
    xleftmargin=0.5em,
    framexleftmargin=0.5em,
    ]{\\NAME}}
  \\endgroup
  \\noindent\\ignorespaces
}

\\newcommand\\showcolor[1]{>>{\\color{#1}\\rule{1em}{0.5em}}<<}

\\newenvironment{question}[1]{
  \\subsubsection*{\\textnormal{\\textit{\\color{BrickRed}#1}}}
  \\phantomsection
  \\addcontentsline{toc}{subsection}{#1}
}{}
\\lstnewenvironment{solution}[1][]{
  \\lstset{style=Show,gobble=2,columns=fixed,#1}
}{}

\\lstdefinestyle{sas-inline}{
basicstyle = \\ttfamily,
style = sas-more-keywords,
language = SAS,
}

\\usepackage{hyperref}

\\pagestyle{plain}

\\begin{document}

\\begin{SAScode}[caption={Test of caption}]
PROC INSIGHT DATA data=fisk;
SCATTER x1 x2 x3 x4 x5 * dosis vgt;
RUN; 
OUTPUT
QUIT; /* a standard SAS comment */
\\end{SAScode}

\\begin{SASoutput}
                           TABLE OF NIVEAU BY FAG

           NIVEAU     FAG

           Frequency|
           Percent  |
           Row Pct  |
           Col Pct  |kem     |mat     |mus     |samf    |  Total
           ---------+--------+--------+--------+--------+
           h        |      0 |      1 |      1 |      0 |      2
                    |   0.00 |  20.00 |  20.00 |   0.00 |  40.00
                    |   0.00 |  50.00 |  50.00 |   0.00 |
                    |   0.00 |  50.00 | 100.00 |   0.00 |
           ---------+--------+--------+--------+--------+
           m        |      0 |      1 |      0 |      1 |      2
                    |   0.00 |  20.00 |   0.00 |  20.00 |  40.00
                    |   0.00 |  50.00 |   0.00 |  50.00 |
                    |   0.00 |  50.00 |   0.00 | 100.00 |
           ---------+--------+--------+--------+--------+
           o        |      1 |      0 |      0 |      0 |      1
                    |  20.00 |   0.00 |   0.00 |   0.00 |  20.00
                    | 100.00 |   0.00 |   0.00 |   0.00 |
                    | 100.00 |   0.00 |   0.00 |   0.00 |
           ---------+--------+--------+--------+--------+
           Total           1        2        1        1        5
                       20.00    40.00    20.00    20.00   100.00

\\end{SASoutput}

\\end{document}
link

answered 21 Jan '12, 21:04

MYaseen208's gravatar image

MYaseen208
1
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×1
×1

Asked: 28 Oct '11, 16:20

Seen: 2,618 times

Last updated: 21 Jan '12, 21:04

Related questions

powered by OSQA