# How to set the correct styles for a SAS code?

I would like to show some SAS code like in SAS Enterprise Guide:

The following is what I've got so far, but only the "string" is more or less like what I want.

Please take into account that I need this at work (eventually, I've found an occasion to use LaTeX at work, yay!), hence I can't install anything on my computer, I can use only Overleaf, ShareLaTeX or Verbosus.

\documentclass[a4paper,12pt, twoside]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}
\usepackage{xcolor}

\usepackage{listings}
\lstset{language=SAS,
breaklines=true,
basicstyle=\ttfamily\bfseries,
columns=fixed,
keepspaces=true,
identifierstyle=\color{blue}\ttfamily,
keywordstyle=\color{cyan}\ttfamily,
stringstyle=\color{purple}\ttfamily,
}

\begin{document}

\begin{lstlisting}
/* librerie */
libname mylib '/mydir/mysubdir';

/* ordinamento */
proc sort data=mylib.myfile out=myfilesorted nodupkey;
by mykey;
run;

* data myfile2; /* istruzione commentata */
data myfilejoinsanother;
merge myfilesorted (in=my)
anotherfile (in=theother rename=(myfield=mykey));
by mykey;
if my;
run;
\end{lstlisting}
\end{document}


A partial solution: You could use minted. It has a sas lexer and you can use a style like borland or vs that nearly resembles your need.

% arara: pdflatex: { shell: yes }
\documentclass[a4paper,12pt, twoside]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}
\usepackage{xcolor}

\usepackage{listings}
\usepackage{minted}
\usemintedstyle{borland}
\lstset{language=SAS,
breaklines=true,
basicstyle=\ttfamily\bfseries,
columns=fixed,
keepspaces=true,
identifierstyle=\color{blue}\ttfamily,
keywordstyle=\color{cyan}\ttfamily,
stringstyle=\color{purple}\ttfamily,
}

\begin{document}

\begin{minted}{sas}
/* librerie */
libname mylib '/mydir/mysubdir';

/* ordinamento */
proc sort data=mylib.myfile out=myfilesorted nodupkey;
by mykey;
run;

* data myfile2; /* istruzione commentata */
data myfilejoinsanother;
merge myfilesorted (in=my)
anotherfile (in=theother rename=(myfield=mykey));
by mykey;
if my;
run;
\end{minted}
\end{document}

• I can only guess that Overleaf, ShareLaTeX etc. support this (at least they have tutorials for it). Jul 18 '17 at 15:26
• This is enough for me, it doesn't work with Overleaf but it works with ShareLaTeX. I'll wait a bit before accepting it but it's OK. Jul 18 '17 at 15:27