I'm using SASnRdisplay for SAS code and output. My code is
\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}
\end{document}
Questions
- I want to put listings for the code
- and want to use BLUE font for SAS reserved words.
Any help will be highly appreciated.
SAScodeenvironment isn't defined here, however… – Seamus Jan 21 '12 at 10:12SASnRdisplaymanual should be your first required reading. Followed by thelistingsmanual if need be. – Seamus Jan 21 '12 at 10:14