Skip to content

Instantly share code, notes, and snippets.

@cjdinger
Last active June 7, 2017 22:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cjdinger/7cf251399ef29b9b90b324a6fc442fca to your computer and use it in GitHub Desktop.
Save cjdinger/7cf251399ef29b9b90b324a6fc442fca to your computer and use it in GitHub Desktop.
Prism.languages.sas = {
'datalines': {
/* fixed datalines pattern to include datalines4 and possible whitespace before terminating ; */
pattern: /(^|[\r\n])\s*(?:(?:data)?lines|cards|datalines4);[\s\S]+?[\r\n](\s)*;/i,
lookbehind: true,
inside: {
'keyword': {
pattern: /^(\s*)(?:(?:data)?lines|cards|datalines4)/i,
lookbehind: true
},
'punctuation': /;/,
'data': {
pattern: /[\s\S]+/,
alias: 'string'
}
}
},
'comment': [
{
pattern: /(^\s*|;\s*)\*.*;/m,
lookbehind: true
},
/\/\*[\s\S]+?\*\//
],
'datetime': {
// '1jan2013'd, '9:25:19pm't, '18jan2003:9:27:05am'dt
pattern: /'[^']+'(?:d|d?t)\b/i,
alias: 'number'
},
'string': /(["'])(?:\1\1|(?!\1)[\s\S])*\1/,
'macrobound': /(?:%macro|%mend)\b/i,
'macrostatement':/(?:%include|%do|%end|%sysfunc|%until|%for|%to|%put|%global|%if|%then|%else|%while|%abort|%macro|%mend|%global|%display|%window|%unquote|%quote|%nrstr|%str)\b/i,
'macroname': /(?:%[a-zA-Z0-9_]*)\b/i,
'procnames': /\b(?:proc|run|quit|mend|access|aceclus|allele|anom|anova|append|arima|autoreg|bom|boxplot|btl|calendar|calis|callrfc|cancorr|candisc|capability|casecontrol|catalog|catmod|chart|cimport|clp|cluster|compare|computab|contents|convert|copy|corr|corresp|countreg|cpm|cport|cusum|data|datasets|datasource|dbf|dbload|define_event|define_tagset|dif|discrim|display|distance|document|dqmatch|dqscheme|dqsrvadm|dqsrvsvc|dtree|entropy|esm|expand|explode|export|factex|factor|family|fastclus|fcmp|fmm|fontreg|forecast|format|forms|freq|fsbrowse|fsedit|fsletter|fslist|fsview|g3d|g3grid|ga|gam|ganno|gantt|gareabar|gbarline|gchart|gcontour|gdevice|geneselect|genmod|geocode|gfont|gimport|ginside|gkeymap|gkpi|glimmix|glm|glmmod|glmpower|glmselect|gmap|goptions|gplot|gproject|gradar|greduce|gremove|greplay|groovy|gslide|gtestit|gtile|haplotype|hpcountreg|hpdmdb|hpds2|hpf|hpfarimaspec|hpfdiagnose|hpfengine|hpfesmspec|hpfevents|hpfexmspec|hpfidmspec|hpforest|hpfselect|hpfucmspec|hplmixed|hplogistic|hpmixed|hpneural|hpnlin|hpreduce|hpreg|hpsample|hpseverity|hpsummary|htsnp|http|iml|import|inbreed|infomaps|intpoint|ishikawa|kde|krige2d|lattice|lifereg|lifetest|loan|loess|logistic|lp|macontrol|macro|mapimport|mcmc|mdc|mds|means|metadata|mi|mianalyze|migrate|mixed|modeclus|model|multtest|nested|netdraw|netflow|nlin|nlmixed|nlp|npar1way|olap|operate|optex|options|optload|optlp|optmilp|optmodel|optqp|optsave|orthoreg|panel|pareto|pdlreg|phreg|plan|plm|plot|pls|pm|pmenu|power|princomp|prinqual|print|printto|probit|proto|prtdef|prtexp|psmooth|pwencode|qdevice|qlim|quantreg|rank|reg|registry|reliability|report|robustreg|rsreg|scaproc|score|seqdesign|seqtest|server|severity|sgdesign|sgpanel|sgplot|sgrender|sgscatter|shewhart|sim2d|similarity|simlin|simnormal|soap|sort|spectra|sql|standard|statespace|statgraph|stdize|stepdisc|stp|summary|surveyfreq|surveylogistic|surveymeans|surveyphreg|surveyreg|surveyselect|syslin|tabulate|tcalis|template|timeid|timeplot|timeseries|tpspline|trans|transpose|transreg|trantab|tree|tscsreg|tspl|ttest|ucm|univariate|varclus|varcomp|variogram|varmax|x11|x12)\b/i,
'statement':/\b(?:abort|array|attrib|axis|endrsubmit|file|filename|footnote|format|goptions|infile|informat|killtask|legend|libname|listtask|note|ods|options|pattern|rdisplay|rget|rsubmit|select|signoff|signon|symbol|sysecho|systask|title|waitfor|where|class|table|model|freq|weight|by|xaxis|yaxis|xaxis2|yaxis2)\b/i,
'keyword': /\b(?:data|else|format|if|input|proc|run|then|ods|options|var|excel|html|html5|rtf|listing|tagsets|graphics|_all_|clear|powerpoint|keep|drop|put|rand|merge|table|tables|var|id|by|define|title|format|filename|goptions|class|cards|cards4|options|listing|title|footnote|retain|close|html|unique|attrib|set|alter|drop|add|compute|endcomp|edit|axis|symbol|dm|entry|entryfootnote|entrytitle|continuouslegend|discretelegend|bandplot|barchart|barchartparm|bihistogram3dparm|blockplot|boxplot|boxplotparm|contourplotparm|densityplot|dropline|ellipse|ellipseparm|fringeplot|histogram|histogramparm|lineparm|loessplot|modelband|needleplot|pbsplineplot|referenceline|regressionplot|scatterplot|scatterplotmatrix|seriesplot|stepplot|surfaceplotparm|vectorplot|dynamic|signon|signoff|rdisplay|rget|waitfor|listtask|killtask|edit|style|array|proc|data|informat|weight|model|declare|sysecho|columns|column|freq|nloptions|break|rbreak|disconnect|describe|execute|update|reset|insert|validate|ranks|where|replace|value|parmcards|parmcards4|distinct|into|from|group)\b/i,
'function': /\b(?:armend|armgtid|arminit|armjoin|armproc|armstop|armstrt|armupdt|abs|addr|addrlong|airy|allperm|anyalnum|anyalpha|anycntrl|anydigit|anyfirst|anygraph|anylower|anyname|anyprint|anypunct|anyspace|anyupper|anyxdigit|arcos|arcosh|arsin|arsinh|artanh|atan|atan2|attrc|attrn|band|beta|betainv|blackclprc|blackptprc|blkshclprc|blshift|bnot|bor|brshift|bxor|byte|allcomb|allcombi|cats|catt|catx|compcost|graycode|label|lexcomb|lexcombi|lexperk|lexperm|logistic|missing|module|poke|pokelong|prxdebug|prxfree|prxnext|prxsubstr|ranbin|rancau|rannor|ranperk|ranperm|ranpoi|rantbl|rantri|ranuni|set|softmax|sortc|sortn|stdize|streaminit|symput|symputx|vnext|cat|catq|cdf|ceil|ceilz|cexist|char|choosec|choosen|cinv|close|cmiss|cnonct|coalesce|coalescec|collate|comb|compare|compbl|compged|complev|compound|compress|constant|convx|convxp|cos|cosh|count|countc|countw|css|curobs|cv|daccdb|daccdbsl|daccsl|daccsyd|dacctab|dairy|datdif|date|datejul|datepart|datetime|day|dclose|dcreate|depdb|depdbsl|depsl|depsyd|deptab|dequote|deviance|dhms|dif|digamma|dim|dinfo|divide|dnum|dopen|doptname|doptnum|dread|dropnote|dsname|dur|durp|envlen|erf|erfc|euclid|exist|exp|fact|fappend|fclose|fcol|fdelete|fetch|fetchobs|fexist|fget|fileexist|filename|fileref|finance|find|findc|findw|finfo|finv|fipname|fipnamel|fipstate|first|floor|floorz|fnonct|fnote|fopen|foptname|foptnum|fpoint|fpos|fput|fread|frewind|frlen|fsep|fuzz|fwrite|gaminv|gamma|garkhclprc|garkhptprc|gcd|geodist|geomean|geomeanz|getoption|getvarc|getvarn|harmean|harmeanz|hbound|hms|holiday|hour|htmldecode|htmlencode|ibessel|ifc|ifn|index|indexc|indexw|input|inputc|inputn|int|intcindex|intck|intcycle|intfit|intfmt|intget|intindex|intnx|intrr|intseas|intshift|inttest|intz|iqr|iorcmsg|irr|jbessel|juldate|juldate7|kurtosis|lag|largest|lbound|lcm|lcomb|left|qleft|length|lengthc|lengthm|lengthn|lfact|lgamma|libname|libref|log|log1px|log10|log2|logbeta|logcdf|logpdf|logsdf|lowcase|qlowcase|lperm|lpnorm|mad|margrclprc|margrptprc|max|md5|mdy|mean|median|min|minute|missing|mod|modulec|modulen|modz|month|mopen|mort|msplint|n|netpv|nliteral|nmiss|notalnum|notalpha|notcntrl|notdigit|note|notfirst|notgraph|notlower|notname|notprint|notpunct|notspace|notupper|notxdigit|npv|nvalid|nwkdom|open|ordinal|pathname|pctl|pdf|peek|peekc|peekclong|peeklong|perm|point|poisson|probbeta|probbnml|probbnrm|probchi|probf|probgam|probhypr|probit|probmc|probnegb|probnorm|probt|propcase|prxchange|prxmatch|prxparen|prxparse|prxposn|ptrlongadd|put|putc|putn|pvp|qtr|quantile|quote|rand|ranexp|rangam|range|rank|rename|repeat|resolve|reverse|rewind|right|rms|round|rounde|roundz|saving|scan|scanq|sdf|second|sign|sin|sinh|skewness|sleep|smallest|soundex|spedis|sqrt|std|stderr|stfips|stname|stnamel|strip|subpad|substr|qsubstr|substrn|sum|sumabs|symexist|symget|symglobl|symlocal|sysmsg|sysparm|sysprocessid|sysprocessname|sysprod|sysrc|system|tan|tanh|time|timepart|tinv|tnonct|today|translate|transtrn|tranwrd|trigamma|trim|qtrim|trimn|trunc|uniform|upcase|qupcase|urldecode|urlencode|uss|uuidgen|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|vvalue|vvaluex|week|weekday|whichc|whichn|year|yieldp|yrdif|yyq|zipcity|zipcitydistance|zipfips|zipname|zipnamel|zipstate|ascebc|delete|ebcasc|fileattr|findfile|getdvi|getjpi|getlog|getmsg|getquota|getsym|getterm|nodename|putlog|putsym|setterm|termin|termout|ttclose|ttcontrl|ttopen|ttread|ttwrite|vms|bquote|nrbquote|eval|nrquote|str|nrstr|qscan|superq|sysevalf|sysfunc|qsysfunc|sysget|unquote|cmpres|qcmpres|compstor|datatyp|dqcase|dqgender|dqgenderinfoget|dqgenderparsed|dqidentify|dqlocaleguess|dqlocaleinfoget|dqlocaleinfolist|dqmatch|dqmatchinfoget|dqmatchparsed|dqparse|dqparseinfoget|dqparsetokenget|dqparsetokenput|dqpattern|dqschemeapply|dqsrvarchjob|dqsrvcopylog|dqsrvdeletelog|dqsrvjobstatus|dqsrvkilljob|dqsrvprofjobfile|dqsrvprofjobrep|dqsrvuser|dqstandardize|dqtoken|effrate|mvalid|nomrate|savings|soapweb|soapwebmeta|soapwipservice|soapwipsrs|soapws|soapwsmeta|squantile|sysexist|timevalue|invcdf|isnull|limmoment|read_array|run_macro|run_sasfile|solve|write_array|grdsvc_enable|grdsvc_getaddr|grdsvc_getinfo|grdsvc_getname|grdsvc_nnodes)\b/i,
// Decimal (1.2e23), hexadecimal (0c1x)
'number': /(?:\B-|\b)(?:[\da-f]+x|\d+(?:\.\d+)?(?:e[+-]?\d+)?)/i,
'operator': /\*\*|\|\||!!|¦¦|<>|><|[~¬^<>]?=|[*\/+\-<>&\|!¦~¬^]|\b(?:eq|ne|gt|lt|ge|le|in|not)\b/i,
'punctuation': /[$%@.(){}\[\];,\\]/
};
@paulkaefer
Copy link

In the operators definition, what does 'Â' represent?

@cjdinger
Copy link
Author

I think that was a transcoding glitch - fixed in the gist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment