Created
May 9, 2016 11:08
-
-
Save mcaceresb/71c45abc7f43f67bc31b9a4e66b34ada to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% --------------------------------------------------------------------- | |
% Program: listings-sas.tex | |
% Author: github.com/mcaceresb | |
% Purpose: SAS language definition for LaTeX listings package | |
% Usage: Add \input{listings-sas.tex} to your preamble | |
% Syntax from | |
% - syntax/sas.vim by James Kidd <[email protected]> | |
\RequirePackage{listings} | |
\RequirePackage{color} | |
\RequirePackage[svgnames]{xcolor} | |
\definecolor{spYellow}{HTML}{ADAD00} | |
% --------------------------------------------------------------------- | |
% SAS language definition | |
\lstdefinelanguage{SAS}{ | |
sensitive=false, | |
alsoletter={\%\&}, | |
% | |
% User variables | |
keywordsprefix=\&, | |
% | |
% Comments | |
morecomment=[f][\color{Green}\slshape][0]*, | |
morecomment=[s]{/*}{*/}, | |
% | |
% Strings | |
morestring=[b]", | |
morestring=[d]', | |
% | |
% Datalines and cards | |
morecomment=[s][\itshape\color{spYellow}]{datalines;}{;}, | |
morecomment=[s][\itshape\color{spYellow}]{cards;}{;}, | |
% | |
% Distinct highlight for proc <proc>, data, run, quit | |
morecomment=[s][\bfseries\color{DarkBlue}]{proc\ }{\ }, | |
morekeywords={}, | |
morekeywords=[2]{ | |
data ,proc ,run ,quit | |
}, | |
% | |
% Macros | |
morekeywords=[3]{ | |
\%bquote ,\%nrbquote ,\%cmpres ,\%qcmpres ,\%compstor ,\%datatyp | |
,\%display ,\%do ,\%else ,\%end ,\%eval ,\%global ,\%goto ,\%if | |
,\%index ,\%input ,\%keydef ,\%label ,\%left ,\%length ,\%let | |
,\%local ,\%lowcase ,\%macro ,\%mend ,\%nrbquote ,\%nrquote | |
,\%nrstr ,\%put ,\%qcmpres ,\%qleft ,\%qlowcase ,\%qscan ,\%qsubstr | |
,\%qsysfunc ,\%qtrim ,\%quote ,\%qupcase ,\%scan ,\%str ,\%substr | |
,\%superq ,\%syscall ,\%sysevalf ,\%sysexec ,\%sysfunc ,\%sysget | |
,\%syslput ,\%sysprod ,\%sysrc ,\%sysrput ,\%then ,\%to ,\%trim | |
,\%unquote ,\%until ,\%upcase ,\%verify ,\%while ,\%window | |
}, | |
% | |
% Statements | |
morekeywords=[4]{ | |
% conditionals | |
do ,if ,then ,else ,end ,until ,while | |
% SAS | |
,abort ,array ,attrib ,by ,call ,cards ,cards4 ,catname ,continue | |
,datalines ,datalines4 ,delete ,delim ,delimiter ,display ,dm ,drop | |
,endsas ,error ,file ,filename ,footnote ,format ,goto ,in ,infile | |
,informat ,input ,keep ,label ,leave ,length ,libname ,link ,list | |
,lostcard ,merge ,missing ,modify ,options ,output ,out ,page ,put | |
,redirect ,remove ,rename ,replace ,retain ,return ,select ,set | |
,skip ,startsas ,stop ,title ,update ,waitsas ,where ,window ,x | |
,systask | |
% SQL | |
,add ,and ,alter ,as ,cascade ,check ,create ,delete ,describe | |
,distinct ,drop ,foreign ,from ,group ,having ,index ,insert ,into | |
,in ,key ,like ,message ,modify ,msgtype ,not ,null ,on ,or ,order | |
,primary ,references ,reset ,restrict ,select ,set ,table ,unique | |
,update ,validate ,view ,where | |
}, | |
% | |
% Built-in functions | |
morekeywords=[5]{ | |
abs ,addr ,airy ,arcos ,arsin ,atan ,attrc ,attrn ,band ,betainv | |
,blshift ,bnot ,bor ,brshift ,bxor ,byte ,cdf ,ceil ,cexist ,cinv | |
,close ,cnonct ,collate ,compbl ,compound ,compress ,cos ,cosh ,css | |
,curobs ,cv ,daccdb ,daccdbsl ,daccsl ,daccsyd ,dacctab ,dairy | |
,date ,datejul ,datepart ,datetime ,day ,dclose ,depdb ,depdbsl | |
,depdbsl ,depsl ,depsl ,depsyd ,depsyd ,deptab ,deptab ,dequote | |
,dhms ,dif ,digamma ,dim ,dinfo ,dnum ,dopen ,doptname ,doptnum | |
,dread ,dropnote ,dsname ,erf ,erfc ,exist ,exp ,fappend ,fclose | |
,fcol ,fdelete ,fetch ,fetchobs ,fexist ,fget ,fileexist ,filename | |
,fileref ,finfo ,finv ,fipname ,fipnamel ,fipstate ,floor ,fnonct | |
,fnote ,fopen ,foptname ,foptnum ,fpoint ,fpos ,fput ,fread ,frewind | |
,frlen ,fsep ,fuzz ,fwrite ,gaminv ,gamma ,getoption ,getvarc | |
,getvarn ,hbound ,hms ,hosthelp ,hour ,ibessel ,index ,indexc | |
,indexw ,input ,inputc ,inputn ,int ,intck ,intnx ,intrr ,irr | |
,jbessel ,juldate ,kurtosis ,lag ,lbound ,left ,length ,lgamma | |
,libname ,libref ,log ,log10 ,log2 ,logpdf ,logpmf ,logsdf ,lowcase | |
,max ,mdy ,mean ,min ,minute ,mod ,month ,mopen ,mort ,n ,netpv | |
,nmiss ,normal ,note ,npv ,open ,ordinal ,pathname ,pdf ,peek ,peekc | |
,pmf ,point ,poisson ,poke ,probbeta ,probbnml ,probchi ,probf | |
,probgam ,probhypr ,probit ,probnegb ,probnorm ,probt ,put ,putc | |
,putn ,qtr ,quote ,ranbin ,rancau ,ranexp ,rangam ,range ,rank | |
,rannor ,ranpoi ,rantbl ,rantri ,ranuni ,repeat ,resolve ,reverse | |
,rewind ,right ,round ,saving ,scan ,sdf ,second ,sign ,sin ,sinh | |
,skewness ,soundex ,spedis ,sqrt ,std ,stderr ,stfips ,stname | |
,stnamel ,substr ,sum ,symget ,sysget ,sysmsg ,sysprod ,sysrc | |
,system ,tan ,tanh ,time ,timepart ,tinv ,tnonct ,today ,translate | |
,tranwrd ,trigamma ,trim ,trimn ,trunc ,uniform ,upcase ,uss ,var | |
,varfmt ,varinfmt ,varlabel ,varlen ,varname ,varnum ,varray | |
,varrayx ,vartype ,verify ,vformat ,vformatd ,vformatdx ,vformatn | |
,vformatnx ,vformatw ,vformatwx ,vformatx ,vinarray ,vinarrayx | |
,vinformat ,vinformatd ,vinformatdx ,vinformatn ,vinformatnx | |
,vinformatw ,vinformatwx ,vinformatx ,vlabel ,vlabelx ,vlength | |
,vlengthx ,vname ,vnamex ,vtype ,vtypex ,weekday ,year ,yyq ,zipfips | |
,zipname ,zipnamel ,zipstate | |
}, | |
% | |
% Literals | |
morekeywords=[6]{ | |
null ,missing ,_all_ ,_automatic_ ,_character_ ,_n_ ,_infile_ | |
,_name_ ,_null_ ,_numeric_ ,_user_ ,_webout_ | |
}, | |
} | |
% --------------------------------------------------------------------- | |
% SAS enhanced editor style | |
\providecommand{\textcolordummy}[2]{#2} | |
\lstalias{sas}{SAS} | |
\lstdefinestyle{sas-editor}{ | |
language = SAS, | |
showstringspaces = false, % Don't underline spaces in strings | |
showspaces = false, % Don't underline spaces | |
breaklines = true, % automatic line b\color{Blue}\color{Blue}reaking | |
breakatwhitespace = true, % breaks only at white space. | |
% | |
% User variables | |
keywordstyle = {\bfseries\color{NavyBlue}\let\textcolor\textcolordummy}, | |
% | |
% Distinct highlight for proc <proc>, data, run, quit | |
keywordstyle = [2]{\bfseries\color{DarkBlue}}, | |
% | |
% Built-in macro functions | |
keywordstyle = [3]{\color{Blue}}, | |
% | |
% Statements | |
keywordstyle = [4]{\color{Blue}}, | |
% | |
% Built-in functions | |
keywordstyle = [5]{\color{Blue}}, | |
% | |
% Built-in functions | |
keywordstyle = [6]{\bfseries\color{Blue}}, | |
% | |
% Strings and comments | |
stringstyle = \color{Purple}, | |
commentstyle = \color{Green}\slshape, | |
% | |
% Numbers Hack (I legit forget why I needed this) | |
literate={0}{{\bfseries\textcolor{SeaGreen}{0}}}{1}% | |
{1}{{\bfseries\textcolor{SeaGreen}{1}}}{1}% | |
{2}{{\bfseries\textcolor{SeaGreen}{2}}}{1}% | |
{3}{{\bfseries\textcolor{SeaGreen}{3}}}{1}% | |
{4}{{\bfseries\textcolor{SeaGreen}{4}}}{1}% | |
{5}{{\bfseries\textcolor{SeaGreen}{5}}}{1}% | |
{6}{{\bfseries\textcolor{SeaGreen}{6}}}{1}% | |
{7}{{\bfseries\textcolor{SeaGreen}{7}}}{1}% | |
{8}{{\bfseries\textcolor{SeaGreen}{8}}}{1}% | |
{9}{{\bfseries\textcolor{SeaGreen}{9}}}{1}% | |
{.0}{{\bfseries\textcolor{SeaGreen}{.0}}}{2}% | |
{.1}{{\bfseries\textcolor{SeaGreen}{.1}}}{2}% | |
{.2}{{\bfseries\textcolor{SeaGreen}{.2}}}{2}% | |
{.3}{{\bfseries\textcolor{SeaGreen}{.3}}}{2}% | |
{.4}{{\bfseries\textcolor{SeaGreen}{.4}}}{2}% | |
{.5}{{\bfseries\textcolor{SeaGreen}{.5}}}{2}% | |
{.6}{{\bfseries\textcolor{SeaGreen}{.6}}}{2}% | |
{.7}{{\bfseries\textcolor{SeaGreen}{.7}}}{2}% | |
{.8}{{\bfseries\textcolor{SeaGreen}{.8}}}{2}% | |
{.9}{{\bfseries\textcolor{SeaGreen}{.9}}}{2}% | |
} | |
% --------------------------------------------------------------------- | |
% Suggested settings | |
% \lstset{ | |
% basicstyle = \setmonofont{DejaVu Sans Mono}\footnotesize\ttfamily, | |
% tabsize = 4, % Tab size | |
% showstringspaces = false, % Don't underline spaces in strings | |
% showspaces = false, % Don't underline spaces | |
% breaklines = true, % automatic line breaking | |
% breakatwhitespace = true, % breaks only at white space. | |
% lineskip = 1.5pt, % Sparing between lines of code | |
% commentstyle = \color{black!50}\itshape \let\textcolor\textcolordummy, | |
% } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment