xref: /vim-8.2.3635/runtime/syntax/sas.vim (revision c572da5f)
1071d4279SBram Moolenaar" Vim syntax file
2071d4279SBram Moolenaar" Language:     SAS
3e0720cbfSBram Moolenaar" Maintainer:   Zhen-Huan Hu <[email protected]>
4e0720cbfSBram Moolenaar" Original Maintainer: James Kidd <[email protected]>
5e0720cbfSBram Moolenaar" Version:      3.0.0
6*c572da5fSBram Moolenaar" Last Change:  Aug 26, 2017
7e0720cbfSBram Moolenaar"
8e0720cbfSBram Moolenaar" 2017 Mar 7
9e0720cbfSBram Moolenaar"
10e0720cbfSBram Moolenaar" Upgrade version number to 3.0. Improvements include:
11e0720cbfSBram Moolenaar" - Improve sync speed
12e0720cbfSBram Moolenaar" - Largely enhance precision
13e0720cbfSBram Moolenaar" - Update keywords in the latest SAS (as of Mar 2017)
14e0720cbfSBram Moolenaar" - Add syntaxes for date/time constants
15e0720cbfSBram Moolenaar" - Add syntax for data lines
16e0720cbfSBram Moolenaar" - Add (back) syntax for TODO in comments
17e0720cbfSBram Moolenaar"
18e0720cbfSBram Moolenaar" 2017 Feb 9
19e0720cbfSBram Moolenaar"
20e0720cbfSBram Moolenaar" Add syntax folding
21e0720cbfSBram Moolenaar"
22e0720cbfSBram Moolenaar" 2016 Oct 10
23e0720cbfSBram Moolenaar"
24e0720cbfSBram Moolenaar" Add highlighting for functions
25e0720cbfSBram Moolenaar"
26e0720cbfSBram Moolenaar" 2016 Sep 14
27e0720cbfSBram Moolenaar"
28e0720cbfSBram Moolenaar" Change the implementation of syntaxing
29e0720cbfSBram Moolenaar" macro function names so that macro parameters same
30e0720cbfSBram Moolenaar" as SAS keywords won't be highlighted
31e0720cbfSBram Moolenaar" (Thank Joug Raw for the suggestion)
32e0720cbfSBram Moolenaar" Add section highlighting:
33e0720cbfSBram Moolenaar" - Use /** and **/ to define a section
34e0720cbfSBram Moolenaar" - It functions the same as a comment but
35e0720cbfSBram Moolenaar"   with different highlighting
36e0720cbfSBram Moolenaar"
37e0720cbfSBram Moolenaar" 2016 Jun 14
38e0720cbfSBram Moolenaar"
39e0720cbfSBram Moolenaar" Major changes so upgrade version number to 2.0
40e0720cbfSBram Moolenaar" Overhaul the entire script (again). Improvements include:
41e0720cbfSBram Moolenaar" - Higher precision
42e0720cbfSBram Moolenaar" - Faster synchronization
43e0720cbfSBram Moolenaar" - Separate color for control statements
44e0720cbfSBram Moolenaar" - Highlight hash and java objects
45e0720cbfSBram Moolenaar" - Highlight macro variables in double quoted strings
46e0720cbfSBram Moolenaar" - Update all syntaxes based on SAS 9.4
47e0720cbfSBram Moolenaar" - Add complete SAS/GRAPH and SAS/STAT procedure syntaxes
48e0720cbfSBram Moolenaar" - Add Proc TEMPLATE and GTL syntaxes
49e0720cbfSBram Moolenaar" - Add complete DS2 syntaxes
50e0720cbfSBram Moolenaar" - Add basic IML syntaxes
51e0720cbfSBram Moolenaar" - Many other improvements and bug fixes
52e0720cbfSBram Moolenaar" Drop support for VIM version < 600
53e0720cbfSBram Moolenaar
54e0720cbfSBram Moolenaarif version < 600
55e0720cbfSBram Moolenaar  syntax clear
56e0720cbfSBram Moolenaarelseif exists('b:current_syntax')
57071d4279SBram Moolenaar  finish
58071d4279SBram Moolenaarendif
59071d4279SBram Moolenaar
60e0720cbfSBram Moolenaarlet s:cpo_save = &cpo
61e0720cbfSBram Moolenaarset cpo&vim
62e0720cbfSBram Moolenaar
63071d4279SBram Moolenaarsyn case ignore
64071d4279SBram Moolenaar
65e0720cbfSBram Moolenaar" Basic SAS syntaxes
66e0720cbfSBram Moolenaarsyn keyword sasOperator and eq ge gt in le lt ne not of or
67e0720cbfSBram Moolenaarsyn keyword sasReserved _all_ _automatic_ _char_ _character_ _data_ _infile_ _last_ _n_ _name_ _null_ _num_ _numeric_ _temporary_ _user_ _webout_
68e0720cbfSBram Moolenaar" Strings
69e0720cbfSBram Moolenaarsyn region sasString start=+'+ skip=+''+ end=+'+ contains=@Spell
70e0720cbfSBram Moolenaarsyn region sasString start=+"+ skip=+""+ end=+"+ contains=sasMacroVariable,@Spell
71e0720cbfSBram Moolenaar" Constants
72e0720cbfSBram Moolenaarsyn match sasNumber /\v<\d+%(\.\d+)=%(>|e[\-+]=\d+>)/ display
73e0720cbfSBram Moolenaarsyn match sasDateTime /\v(['"])\d{2}%(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\d{2}%(\d{2})=:\d{2}:\d{2}%(:\d{2})=%(am|pm)\1dt>/ display
74e0720cbfSBram Moolenaarsyn match sasDateTime /\v(['"])\d{2}%(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\d{2}%(\d{2})=\1d>/ display
75e0720cbfSBram Moolenaarsyn match sasDateTime /\v(['"])\d{2}:\d{2}%(:\d{2})=%(am|pm)\1t>/ display
76e0720cbfSBram Moolenaar" Comments
77e0720cbfSBram Moolenaarsyn keyword sasTodo todo tbd fixme contained
78e0720cbfSBram Moolenaarsyn region sasComment start='/\*' end='\*/' contains=sasTodo
79e0720cbfSBram Moolenaarsyn region sasComment start='\v%(^|;)\s*\zs\%=\*' end=';'me=s-1 contains=sasTodo
80e0720cbfSBram Moolenaarsyn region sasSectLbl matchgroup=sasSectLblEnds start='/\*\*\s*' end='\s*\*\*/' concealends
81e0720cbfSBram Moolenaar" Macros
82e0720cbfSBram Moolenaarsyn match sasMacroVariable '\v\&+\w+%(\.\w+)=' display
83e0720cbfSBram Moolenaarsyn match sasMacroReserved '\v\%%(abort|by|copy|display|do|else|end|global|goto|if|include|input|let|list|local|macro|mend|put|return|run|symdel|syscall|sysexec|syslput|sysrput|then|to|until|window|while)>' display
84e0720cbfSBram Moolenaarsyn region sasMacroFunction matchgroup=sasMacroFunctionName start='\v\%\w+\ze\(' end=')'he=s-1 contains=@sasBasicSyntax,sasMacroFunction
85e0720cbfSBram Moolenaarsyn region sasMacroFunction matchgroup=sasMacroFunctionName start='\v\%q=sysfunc\ze\(' end=')'he=s-1 contains=@sasBasicSyntax,sasMacroFunction,sasDataStepFunction
86e0720cbfSBram Moolenaar" Syntax cluster for basic SAS syntaxes
87e0720cbfSBram Moolenaarsyn cluster sasBasicSyntax contains=sasOperator,sasReserved,sasNumber,sasDateTime,sasString,sasComment,sasMacroReserved,sasMacroFunction,sasMacroVariable,sasSectLbl
88071d4279SBram Moolenaar
89e0720cbfSBram Moolenaar" Formats
90e0720cbfSBram Moolenaarsyn match sasFormat '\v\$\w+\.' display contained
91e0720cbfSBram Moolenaarsyn match sasFormat '\v<\w+\.%(\d+>)=' display contained
92e0720cbfSBram Moolenaarsyn region sasFormatContext start='.' end=';'me=s-1 contained contains=@sasBasicSyntax,sasFormat
93071d4279SBram Moolenaar
94e0720cbfSBram Moolenaar" Define global statements that can be accessed out of data step or procedures
95e0720cbfSBram Moolenaarsyn keyword sasGlobalStatementKeyword catname dm endsas filename footnote footnote1 footnote2 footnote3 footnote4 footnote5 footnote6 footnote7 footnote8 footnote9 footnote10 missing libname lock ods options page quit resetline run sasfile skip sysecho title title1 title2 title3 title4 title5 title6 title7 title8 title9 title10 contained
96e0720cbfSBram Moolenaarsyn keyword sasGlobalStatementODSKeyword chtml csvall docbook document escapechar epub epub2 epub3 exclude excel graphics html html3 html5 htmlcss imode listing markup output package path pcl pdf preferences phtml powerpoint printer proclabel proctitle ps results rtf select show tagsets trace usegopt verify wml contained
97e0720cbfSBram Moolenaarsyn match sasGlobalStatement '\v%(^|;)\s*\zs\h\w*>' display transparent contains=sasGlobalStatementKeyword
98e0720cbfSBram Moolenaarsyn match sasGlobalStatement '\v%(^|;)\s*\zsods>' display transparent contains=sasGlobalStatementKeyword nextgroup=sasGlobalStatementODSKeyword skipwhite skipnl skipempty
99071d4279SBram Moolenaar
100e0720cbfSBram Moolenaar" Data step statements, 9.4
101e0720cbfSBram Moolenaarsyn keyword sasDataStepFunctionName abs addr addrlong airy allcomb 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 blkshptprc blshift bnot bor brshift bxor byte cat catq cats catt catx cdf ceil ceilz cexist char choosec choosen cinv close cmiss cnonct coalesce coalescec collate comb compare compbl compfuzz compged complev compound compress constant convx convxp cos cosh cot count countc countw csc css cumipmt cumprinc 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 dosubl dread dropnote dsname dsncatlgd dur durp effrate envlen erf erfc euclid exist exp fact fappend fclose fcol fcopy fdelete fetch fetchobs fexist fget fileexist filename fileref finance find findc findw finfo finv fipname fipnamel fipstate first floor floorz fmtinfo 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 graycode harmean harmeanz hbound hms holiday holidayck holidaycount holidayname holidaynx holidayny holidaytest 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 iorcmsg ipmt iqr irr jbessel juldate juldate7 kurtosis lag largest lbound lcm lcomb left length lengthc lengthm lengthn lexcomb lexcombi lexperk lexperm lfact lgamma libname libref log log1px log10 log2 logbeta logcdf logistic logpdf logsdf lowcase lperm lpnorm mad margrclprc margrptprc max md5 mdy mean median min minute missing mod modexist module modulec modulen modz month mopen mort msplint mvalid contained
102e0720cbfSBram Moolenaarsyn keyword sasDataStepFunctionName n netpv nliteral nmiss nomrate normal 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 pmt point poisson ppmt 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 ranbin rancau rand ranexp rangam range rank rannor ranpoi rantbl rantri ranuni rename repeat resolve reverse rewind right rms round rounde roundz saving savings scan sdf sec second sha256 sha256hex sha256hmachex sign sin sinh skewness sleep smallest soapweb soapwebmeta soapwipservice soapwipsrs soapws soapwsmeta soundex spedis sqrt squantile std stderr stfips stname stnamel strip subpad substr substrn sum sumabs symexist symget symglobl symlocal sysexist sysget sysmsg sysparm sysprocessid sysprocessname sysprod sysrc system tan tanh time timepart timevalue tinv tnonct today translate transtrn tranwrd trigamma trim trimn trunc tso typeof tzoneid tzonename tzoneoff tzones2u tzoneu2s uniform upcase 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 wto year yieldp yrdif yyq zipcity zipcitydistance zipfips zipname zipnamel zipstate contained
103e0720cbfSBram Moolenaarsyn keyword sasDataStepCallRoutineName allcomb allcombi allperm cats catt catx compcost execute graycode is8601_convert label lexcomb lexcombi lexperk lexperm logistic missing module poke pokelong prxchange prxdebug prxfree prxnext prxposn prxsubstr ranbin rancau rancomb ranexp rangam rannor ranperk ranperm ranpoi rantbl rantri ranuni scan set sleep softmax sortc sortn stdize streaminit symput symputx system tanh tso vname vnext wto contained
104e0720cbfSBram Moolenaarsyn region sasDataStepFunctionContext start='(' end=')' contained contains=@sasBasicSyntax,sasDataStepFunction
105e0720cbfSBram Moolenaarsyn region sasDataStepFunctionFormatContext start='(' end=')' contained contains=@sasBasicSyntax,sasDataStepFunction,sasFormat
106e0720cbfSBram Moolenaarsyn match sasDataStepFunction '\v<\w+\ze\(' contained contains=sasDataStepFunctionName,sasDataStepCallRoutineName nextgroup=sasDataStepFunctionContext
107e0720cbfSBram Moolenaarsyn match sasDataStepFunction '\v%(input|put)\ze\(' contained contains=sasDataStepFunctionName nextgroup=sasDataStepFunctionFormatContext
108e0720cbfSBram Moolenaarsyn keyword sasDataStepHashMethodName add check clear definedata definedone definekey delete do_over equals find find_next find_prev first has_next has_prev last next output prev ref remove removedup replace replacedup reset_dup setcur sum sumdup contained
109e0720cbfSBram Moolenaarsyn region sasDataStepHashMethodContext start='(' end=')' contained contains=@sasBasicSyntax,sasDataStepFunction
110e0720cbfSBram Moolenaarsyn match sasDataStepHashMethod '\v\.\w+\ze\(' contained contains=sasDataStepHashMethodName nextgroup=sasDataStepHashMethodContext
111e0720cbfSBram Moolenaarsyn keyword sasDataStepHashAttributeName item_size num_items contained
112e0720cbfSBram Moolenaarsyn match sasDataStepHashAttribute '\v\.\w+>\ze\_[^(]' display contained contains=sasDataStepHashAttributeName
113e0720cbfSBram Moolenaarsyn keyword sasDataStepControl continue do end go goto if leave link otherwise over return select to until when while contained
114e0720cbfSBram Moolenaarsyn keyword sasDataStepControl else then contained nextgroup=sasDataStepStatementKeyword skipwhite skipnl skipempty
115e0720cbfSBram Moolenaarsyn keyword sasDataStepHashOperator _new_ contained
116e0720cbfSBram Moolenaarsyn keyword sasDataStepStatementKeyword abort array attrib by call cards cards4 datalines datalines4 dcl declare delete describe display drop error execute file format infile informat input keep label length lines lines4 list lostcard merge modify output put putlog redirect remove rename replace retain set stop update where window contained
117e0720cbfSBram Moolenaarsyn keyword sasDataStepStatementHashKeyword hash hiter javaobj contained
118e0720cbfSBram Moolenaarsyn match sasDataStepStatement '\v%(^|;)\s*\zs\h\w*>' display contained contains=sasDataStepStatementKeyword,sasGlobalStatementKeyword
119e0720cbfSBram Moolenaarsyn match sasDataStepStatement '\v%(^|;)\s*\zs%(dcl|declare)>' display contained contains=sasDataStepStatementKeyword nextgroup=sasDataStepStatementHashKeyword skipwhite skipnl skipempty
120e0720cbfSBram Moolenaarsyn match sasDataStepStatement '\v%(^|;)\s*\zsods>' display contained contains=sasGlobalStatementKeyword nextgroup=sasGlobalStatementODSKeyword skipwhite skipnl skipempty
121e0720cbfSBram Moolenaarsyn match sasDataStepStatement '\v%(^|;)\s*\zs%(format|informat|input|put)>' display contained contains=sasDataStepStatementKeyword nextgroup=sasFormatContext skipwhite skipnl skipempty
122e0720cbfSBram Moolenaarsyn match sasDataStepStatement '\v%(^|;)\s*\zs%(cards|datalines|lines)4=\s*;' display contained contains=sasDataStepStatementKeyword nextgroup=sasDataLine skipwhite skipnl skipempty
123*c572da5fSBram Moolenaarsyn region sasDataLine start='^' end='^\s*;'me=s-1 contained
124e0720cbfSBram Moolenaarsyn region sasDataStep matchgroup=sasSectionKeyword start='\v%(^|;)\s*\zsdata>' end='\v%(^|;)\s*%(run|data|proc|endsas)>'me=s-1 fold contains=@sasBasicSyntax,@sasDataStepSyntax
125e0720cbfSBram Moolenaarsyn cluster sasDataStepSyntax contains=sasDataStepFunction,sasDataStepHashOperator,sasDataStepHashAttribute,sasDataStepHashMethod,sasDataStepControl,sasDataStepStatement
126e37d50a5SBram Moolenaar
127e0720cbfSBram Moolenaar" Procedures, base SAS, 9.4
128e0720cbfSBram Moolenaarsyn keyword sasProcStatementKeyword abort age append array attrib audit block break by calid cdfplot change checkbox class classlev column compute contents copy create datarow dbencoding define delete deletefunc deletesubr delimiter device dialog dur endcomp exact exchange exclude explore fin fmtlib fontfile fontpath format formats freq function getnames guessingrows hbar hdfs histogram holidur holifin holistart holivar id idlabel informat inset invalue item key keylabel keyword label line link listfunc listsubr mapmiss mapreduce mean menu messages meta modify opentype outargs outdur outfin output outstart pageby partial picture pie pig plot ppplot printer probplot profile prompter qqplot radiobox ranks rbreak rbutton rebuild record remove rename repair report roptions save select selection separator source star start statistics struct submenu subroutine sum sumby table tables test text trantab truetype type1 types value var vbar ways weight where with write contained
129e0720cbfSBram Moolenaarsyn match sasProcStatement '\v%(^|;)\s*\zs\h\w*>' display contained contains=sasProcStatementKeyword,sasGlobalStatementKeyword
130e0720cbfSBram Moolenaarsyn match sasProcStatement '\v%(^|;)\s*\zsods>' display contained contains=sasGlobalStatementKeyword nextgroup=sasGlobalStatementODSKeyword skipwhite skipnl skipempty
131e0720cbfSBram Moolenaarsyn match sasProcStatement '\v%(^|;)\s*\zs%(format|informat)>' display contained contains=sasProcStatementKeyword nextgroup=sasFormatContext skipwhite skipnl skipempty
132e0720cbfSBram Moolenaarsyn region sasProc matchgroup=sasSectionKeyword start='\v%(^|;)\s*\zsproc%(\s+\h\w*)=>' end='\v%(^|;)\s*%(run|data|proc|endsas)>'me=s-1 fold contains=@sasBasicSyntax,sasDataStepFunction,sasProcStatement
133e0720cbfSBram Moolenaarsyn region sasProc matchgroup=sasSectionKeyword start='\v%(^|;)\s*\zsproc\s+%(catalog|chart|datasets|document|plot)>' end='\v%(^|;)\s*%(quit|data|proc|endsas)>'me=s-1 fold contains=@sasBasicSyntax,sasDataStepFunction,sasProcStatement
134071d4279SBram Moolenaar
135e0720cbfSBram Moolenaar" Procedures, SAS/GRAPH, 9.4
136e0720cbfSBram Moolenaarsyn keyword sasGraphProcStatementKeyword add area axis bar block bubble2 byline cc ccopy cdef cdelete chart cmap choro copy delete device dial donut exclude flow format fs goptions gout grid group hbar hbar3d hbullet hslider htrafficlight id igout label legend list modify move nobyline note pattern pie pie3d plot plot2 preview prism quit rename replay select scatter speedometer star surface symbol tc tcopy tdef tdelete template tile toggle treplay vbar vbar3d vtrafficlight vbullet vslider where contained
137e0720cbfSBram Moolenaarsyn match sasGraphProcStatement '\v%(^|;)\s*\zs\h\w*>' display contained contains=sasGraphProcStatementKeyword,sasGlobalStatementKeyword
138e0720cbfSBram Moolenaarsyn match sasGraphProcStatement '\v%(^|;)\s*\zsformat>' display contained contains=sasGraphProcStatementKeyword nextgroup=sasFormatContext skipwhite skipnl skipempty
139e0720cbfSBram Moolenaarsyn region sasGraphProc matchgroup=sasSectionKeyword start='\v%(^|;)\s*\zsproc\s+%(g3d|g3grid|ganno|gcontour|gdevice|geocode|gfont|ginside|goptions|gproject|greduce|gremove|mapimport)>' end='\v%(^|;)\s*%(run|data|proc|endsas)>'me=s-1 fold contains=@sasBasicSyntax,sasDataStepFunction,sasGraphProcStatement
140e0720cbfSBram Moolenaarsyn region sasGraphProc matchgroup=sasSectionKeyword start='\v%(^|;)\s*\zsproc\s+%(gareabar|gbarline|gchart|gkpi|gmap|gplot|gradar|greplay|gslide|gtile)>' end='\v%(^|;)\s*%(quit|data|proc|endsas)>'me=s-1 fold contains=@sasBasicSyntax,sasDataStepFunction,sasGraphProcStatement
141071d4279SBram Moolenaar
142e0720cbfSBram Moolenaar" Procedures, SAS/STAT, 14.1
143e0720cbfSBram Moolenaarsyn keyword sasAnalyticalProcStatementKeyword absorb add array assess baseline bayes beginnodata bivar bootstrap bounds by cdfplot cells class cluster code compute condition contrast control coordinates copy cosan cov covtest coxreg der design determ deviance direct directions domain effect effectplot effpart em endnodata equality estimate exact exactoptions factor factors fcs filter fitindex format freq fwdlink gender grid group grow hazardratio height hyperprior id impjoint inset insetgroup invar invlink ippplot lincon lineqs lismod lmtests location logistic loglin lpredplot lsmeans lsmestimate manova matings matrix mcmc mean means missmodel mnar model modelaverage modeleffects monotone mstruct mtest multreg name nlincon nloptions oddsratio onecorr onesamplefreq onesamplemeans onewayanova outfiles output paired pairedfreq pairedmeans parameters parent parms partial partition path pathdiagram pcov performance plot population poststrata power preddist predict predpplot priors process probmodel profile prune pvar ram random ratio reference refit refmodel renameparm repeated replicate repweights response restore restrict retain reweight ridge rmsstd roc roccontrast rules samplesize samplingunit seed size scale score selection show simtests simulate slice std stderr store strata structeq supplementary table tables test testclass testfreq testfunc testid time transform treatments trend twosamplefreq twosamplemeans towsamplesurvival twosamplewilcoxon uds units univar var variance varnames weight where with zeromodel contained
144e0720cbfSBram Moolenaarsyn match sasAnalyticalProcStatement '\v%(^|;)\s*\zs\h\w*>' display contained contains=sasAnalyticalProcStatementKeyword,sasGlobalStatementKeyword
145e0720cbfSBram Moolenaarsyn match sasAnalyticalProcStatement '\v%(^|;)\s*\zsods>' display contained contains=sasGlobalStatementKeyword nextgroup=sasGlobalStatementODSKeyword skipwhite skipnl skipempty
146e0720cbfSBram Moolenaarsyn match sasAnalyticalProcStatement '\v%(^|;)\s*\zsformat>' display contained contains=sasAnalyticalProcStatementKeyword nextgroup=sasFormatContext skipwhite skipnl skipempty
147e0720cbfSBram Moolenaarsyn region sasAnalyticalProc matchgroup=sasSectionKeyword start='\v%(^|;)\s*\zsproc\s+%(aceclus|adaptivereg|bchoice|boxplot|calis|cancorr|candisc|cluster|corresp|discrim|distance|factor|fastclus|fmm|freq|gam|gampl|gee|genmod|glimmix|glmmod|glmpower|glmselect|hpcandisc|hpfmm|hpgenselect|hplmixed|hplogistic|hpmixed|hpnlmod|hppls|hpprincomp|hpquantselect|hpreg|hpsplit|iclifetest|icphreg|inbreed|irt|kde|krige2d|lattice|lifereg|lifetest|loess|logistic|mcmc|mds|mi|mianalyze|mixed|modeclus|multtest|nested|nlin|nlmixed|npar1way|orthoreg|phreg|plm|pls|power|princomp|prinqual|probit|quantlife|quantreg|quantselect|robustreg|rsreg|score|seqdesign|seqtest|sim2d|simnormal|spp|stdize|stdrate|stepdisc|surveyfreq|surveyimpute|surveylogistic|surveymeans|surveyphreg|surveyreg|surveyselect|tpspline|transreg|tree|ttest|varclus|varcomp|variogram)>' end='\v%(^|;)\s*%(run|data|proc|endsas)>'me=s-1 fold contains=@sasBasicSyntax,sasDataStepControl,sasDataStepFunction,sasAnalyticalProcStatement
148e0720cbfSBram Moolenaarsyn region sasAnalyticalProc matchgroup=sasSectionKeyword start='\v%(^|;)\s*\zsproc\s+%(anova|arima|catmod|factex|glm|model|optex|plan|reg)>' end='\v%(^|;)\s*%(quit|data|proc|endsas)>'me=s-1 fold contains=@sasBasicSyntax,sasDataStepControl,sasDataStepFunction,sasAnalyticalProcStatement
149071d4279SBram Moolenaar
150e0720cbfSBram Moolenaar" Procedures, ODS graphics, 9.4
151e0720cbfSBram Moolenaarsyn keyword sasODSGraphicsProcStatementKeyword band block bubble by colaxis compare dattrvar density dot dropline dynamic ellipse ellipseparm format fringe gradlegend hbar hbarbasic hbarparm hbox heatmap heatmapparm highlow histogram hline inset keylegend label lineparm loess matrix needle parent panelby pbspline plot polygon refline reg rowaxis scatter series spline step style styleattrs symbolchar symbolimage text vbar vbarbasic vbarparm vbox vector vline waterfall where xaxis x2axis yaxis y2axis yaxistable contained
152e0720cbfSBram Moolenaarsyn match sasODSGraphicsProcStatement '\v%(^|;)\s*\zs\h\w*>' display contained contains=sasODSGraphicsProcStatementKeyword,sasGlobalStatementKeyword
153e0720cbfSBram Moolenaarsyn match sasODSGraphicsProcStatement '\v%(^|;)\s*\zsods>' display contained contains=sasGlobalStatementKeyword nextgroup=sasGlobalStatementODSKeyword skipwhite skipnl skipempty
154e0720cbfSBram Moolenaarsyn match sasODSGraphicsProcStatement '\v%(^|;)\s*\zsformat>' display contained contains=sasODSGraphicsProcStatementKeyword nextgroup=sasFormatContext skipwhite skipnl skipempty
155e0720cbfSBram Moolenaarsyn region sasODSGraphicsProc matchgroup=sasSectionKeyword start='\v%(^|;)\s*\zsproc\s+%(sgdesign|sgpanel|sgplot|sgrender|sgscatter)>' end='\v%(^|;)\s*%(run|data|proc|endsas)>'me=s-1 fold contains=@sasBasicSyntax,sasDataStepFunction,sasODSGraphicsProcStatement
156071d4279SBram Moolenaar
157e0720cbfSBram Moolenaar" Proc TEMPLATE, 9.4
158e0720cbfSBram Moolenaarsyn keyword sasProcTemplateClause as into
159e0720cbfSBram Moolenaarsyn keyword sasProcTemplateStatementKeyword block break cellstyle class close column compute continue define delete delstream do done dynamic edit else end eval flush footer header import iterate link list mvar ndent next nmvar notes open path put putl putlog putq putstream putvars replace set source stop style test text text2 text3 translate trigger unblock unset xdent contained
160e0720cbfSBram Moolenaarsyn keyword sasProcTemplateStatementComplexKeyword cellvalue column crosstabs event footer header statgraph style table tagset contained
161e0720cbfSBram Moolenaarsyn keyword sasProcTemplateGTLStatementKeyword axislegend axistable bandplot barchart barchartparm begingraph beginpolygon beginpolyline bihistogram3dparm blockplot boxplot boxplotparm bubbleplot continuouslegend contourplotparm dendrogram discretelegend drawarrow drawimage drawline drawoval drawrectangle drawtext dropline ellipse ellipseparm endgraph endinnermargin endlayout endpolygon endpolyline endsidebar entry entryfootnote entrytitle fringeplot heatmap heatmapparm highlowplot histogram histogramparm innermargin layout legenditem legendtextitems linechart lineparm loessplot mergedlegend modelband needleplot pbsplineplot polygonplot referenceline regressionplot scatterplot seriesplot sidebar stepplot surfaceplotparm symbolchar symbolimage textplot vectorplot waterfallchart contained
162e0720cbfSBram Moolenaarsyn keyword sasProcTemplateGTLComplexKeyword datalattice datapanel globallegend gridded lattice overlay overlayequated overlay3d region contained
163e0720cbfSBram Moolenaarsyn match sasProcTemplateStatement '\v%(^|;)\s*\zs\h\w*>' display contained contains=sasProcTemplateStatementKeyword,sasProcTemplateGTLStatementKeyword,sasGlobalStatementKeyword
164e0720cbfSBram Moolenaarsyn match sasProcTemplateStatement '\v%(^|;)\s*\zsdefine>' display contained contains=sasProcTemplateStatementKeyword nextgroup=sasProcTemplateStatementComplexKeyword skipwhite skipnl skipempty
165e0720cbfSBram Moolenaarsyn match sasProcTemplateStatement '\v%(^|;)\s*\zslayout>' display contained contains=sasProcTemplateGTLStatementKeyword nextgroup=sasProcTemplateGTLComplexKeyword skipwhite skipnl skipempty
166e0720cbfSBram Moolenaarsyn match sasProcTemplateStatement '\v%(^|;)\s*\zsods>' display contained contains=sasGlobalStatementKeyword nextgroup=sasGlobalStatementODSKeyword skipwhite skipnl skipempty
167e0720cbfSBram Moolenaarsyn region sasProcTemplate matchgroup=sasSectionKeyword start='\v%(^|;)\s*\zsproc\s+template>' end='\v%(^|;)\s*%(run|data|proc|endsas)>'me=s-1 fold contains=@sasBasicSyntax,sasProcTemplateClause,sasProcTemplateStatement
168071d4279SBram Moolenaar
169e0720cbfSBram Moolenaar" Proc SQL, 9.4
170e0720cbfSBram Moolenaarsyn keyword sasProcSQLFunctionName avg count css cv freq max mean median min n nmiss prt range std stderr sum sumwgt t uss var contained
171e0720cbfSBram Moolenaarsyn region sasProcSQLFunctionContext start='(' end=')' contained contains=@sasBasicSyntax,sasProcSQLFunction
172e0720cbfSBram Moolenaarsyn match sasProcSQLFunction '\v<\w+\ze\(' contained contains=sasProcSQLFunctionName,sasDataStepFunctionName nextgroup=sasProcSQLFunctionContext
173e0720cbfSBram Moolenaarsyn keyword sasProcSQLClause add asc between by calculated cascade case check connection constraint cross desc distinct drop else end escape except exists foreign from full group having in inner intersect into is join key left libname like modify natural newline notrim null on order outer primary references restrict right separated set then to trimmed union unique user using values when where contained
174e0720cbfSBram Moolenaarsyn keyword sasProcSQLClause as contained nextgroup=sasProcSQLStatementKeyword skipwhite skipnl skipempty
175e0720cbfSBram Moolenaarsyn keyword sasProcSQLStatementKeyword connect delete disconnect execute insert reset select update validate contained
176e0720cbfSBram Moolenaarsyn keyword sasProcSQLStatementComplexKeyword alter create describe drop contained nextgroup=sasProcSQLStatementNextKeyword skipwhite skipnl skipempty
177e0720cbfSBram Moolenaarsyn keyword sasProcSQLStatementNextKeyword index table view contained
178e0720cbfSBram Moolenaarsyn match sasProcSQLStatement '\v%(^|;)\s*\zs\h\w*>' display contained contains=sasProcSQLStatementKeyword,sasGlobalStatementKeyword
179e0720cbfSBram Moolenaarsyn match sasProcSQLStatement '\v%(^|;)\s*\zs%(alter|create|describe|drop)>' display contained contains=sasProcSQLStatementComplexKeyword nextgroup=sasProcSQLStatementNextKeyword skipwhite skipnl skipempty
180e0720cbfSBram Moolenaarsyn match sasProcSQLStatement '\v%(^|;)\s*\zsvalidate>' display contained contains=sasProcSQLStatementKeyword nextgroup=sasProcSQLStatementKeyword,sasProcSQLStatementComplexKeyword skipwhite skipnl skipempty
181e0720cbfSBram Moolenaarsyn match sasProcSQLStatement '\v%(^|;)\s*\zsods>' display contained contains=sasGlobalStatementKeyword nextgroup=sasGlobalStatementODSKeyword skipwhite skipnl skipempty
182e0720cbfSBram Moolenaarsyn region sasProcSQL matchgroup=sasSectionKeyword start='\v%(^|;)\s*\zsproc\s+sql>' end='\v%(^|;)\s*%(quit|data|proc|endsas)>'me=s-1 fold contains=@sasBasicSyntax,sasProcSQLFunction,sasProcSQLClause,sasProcSQLStatement
183071d4279SBram Moolenaar
184e0720cbfSBram Moolenaar" SAS/DS2, 9.4
185e0720cbfSBram Moolenaarsyn keyword sasDS2FunctionName abs anyalnum anyalpha anycntrl anydigit anyfirst anygraph anylower anyname anyprint anypunct anyspace anyupper anyxdigit arcos arcosh arsin arsinh artanh atan atan2 band beta betainv blackclprc blackptprc blkshclprc blkshptprc blshift bnot bor brshift bxor byte cat cats catt catx ceil ceilz choosec choosen cmp cmpt coalesce coalescec comb compare compbl compfuzz compound compress constant convx convxp cos cosh count countc countw css cumipmt cumprinc cv datdif date datejul datepart datetime day dequote deviance dhms dif digamma dim divide dur durp effrate erf erfc exp fact find findc findw floor floorz fmtinfo fuzz gaminv gamma garkhclprc garkhptprc gcd geodist geomean geomeanz harmean harmeanz hbound hms holiday hour index indexc indexw inputc inputn int intcindex intck intcycle intdt intfit intget intindex intnest intnx intrr intseas intshift inttest intts intz ipmt iqr irr juldate juldate7 kcount kstrcat kstrip kupdate kupdates kurtosis lag largest lbound lcm left length lengthc lengthm lengthn lgamma log logbeta log10 log1px log2 lowcase mad margrclprc margrptprc max md5 mdy mean median min minute missing mod modz month mort n ndims netpv nmiss nomrate notalnum notalpha notcntrl notdigit notfirst notgraph notlower notname notprint notpunct notspace notupper notxdigit npv null nwkdom ordinal pctl perm pmt poisson power ppmt probbeta probbnml probbnrm probchi probdf probf probgam probhypr probit probmc probmed probnegb probnorm probt prxchange prxmatch prxparse prxposn put pvp qtr quote ranbin rancau rand ranexp rangam range rank rannor ranpoi rantbl rantri ranuni repeat reverse right rms round rounde roundz savings scan sec second sha256hex sha256hmachex sign sin sinh skewness sleep smallest sqlexec sqrt std stderr streaminit strip substr substrn sum sumabs tan tanh time timepart timevalue tinv to_date to_double to_time to_timestamp today translate transtrn tranwrd trigamma trim trimn trunc uniform upcase uss uuidgen var verify vformat vinarray vinformat vlabel vlength vname vtype week weekday whichc whichn year yieldp yrdif yyq contained
186e0720cbfSBram Moolenaarsyn region sasDS2FunctionContext start='(' end=')' contained contains=@sasBasicSyntax,sasDS2Function
187e0720cbfSBram Moolenaarsyn match sasDS2Function '\v<\w+\ze\(' contained contains=sasDS2FunctionName nextgroup=sasDS2FunctionContext
188e0720cbfSBram Moolenaarsyn keyword sasDS2Control continue data dcl declare do drop else end enddata endpackage endthread from go goto if leave method otherwise package point return select then thread to until when while contained
189e0720cbfSBram Moolenaarsyn keyword sasDS2StatementKeyword array by forward keep merge output put rename retain set stop vararray varlist contained
190e0720cbfSBram Moolenaarsyn keyword sasDS2StatementComplexKeyword package thread contained
191e0720cbfSBram Moolenaarsyn match sasDS2Statement '\v%(^|;)\s*\zs\h\w*>' display contained contains=sasDS2StatementKeyword,sasGlobalStatementKeyword
192e0720cbfSBram Moolenaarsyn match sasDS2Statement '\v%(^|;)\s*\zs%(dcl|declare|drop)>' display contained contains=sasDS2StatementKeyword nextgroup=sasDS2StatementComplexKeyword skipwhite skipnl skipempty
193e0720cbfSBram Moolenaarsyn match sasDS2Statement '\v%(^|;)\s*\zsods>' display contained contains=sasGlobalStatementKeyword nextgroup=sasGlobalStatementODSKeyword skipwhite skipnl skipempty
194e0720cbfSBram Moolenaarsyn region sasDS2 matchgroup=sasSectionKeyword start='\v%(^|;)\s*\zsproc\s+ds2>' end='\v%(^|;)\s*%(quit|data|proc|endsas)>'me=s-1 fold contains=@sasBasicSyntax,sasDS2Function,sasDS2Control,sasDS2Statement
195071d4279SBram Moolenaar
196e0720cbfSBram Moolenaar" SAS/IML, 14.1
197e0720cbfSBram Moolenaarsyn keyword sasIMLFunctionName abs all allcomb allperm any apply armasim bin blankstr block branks bspline btran byte char choose col colvec concat contents convexit corr corr2cov countmiss countn countunique cov cov2corr covlag cshape cusum cuprod cv cvexhull datasets design designf det diag dif dimension distance do duration echelon eigval eigvec element exp expmatrix expandgrid fft forward froot full gasetup geomean ginv hadamard half hankel harmean hdir hermite homogen i ifft insert int inv invupdt isempty isskipped j jroot kurtosis lag length loc log logabsdet mad magic mahalanobis max mean median min mod moduleic modulein name ncol ndx2sub nleng norm normal nrow num opscal orpol parentname palette polyroot prod product pv quartile rancomb randdirichlet randfun randmultinomial randmvt randnormal randwishart ranperk ranperm range rank ranktie rates ratio remove repeat root row rowcat rowcatc rowvec rsubstr sample setdif shape shapecol skewness solve sparse splinev spot sqrsym sqrt sqrvech ssq standard std storage sub2ndx substr sum sweep symsqr t toeplitz trace trisolv type uniform union unique uniqueby value var vecdiag vech xmult xsect yield contained
198e0720cbfSBram Moolenaarsyn keyword sasIMLCallRoutineName appcort armacov armalik bar box change comport delete eigen execute exportdatasettor exportmatrixtor farmacov farmafit farmalik farmasim fdif gaend gagetmem gagetval gainit gareeval garegen gasetcro gasetmut gasetobj gasetsel gblkvp gblkvpd gclose gdelete gdraw gdrawl geneig ggrid ginclude gopen gpie gpiexy gpoint gpoly gport gportpop gportstk gscale gscript gset gshow gsorth gstart gstop gstrlen gtext gvtext gwindow gxaxis gyaxis heatmapcont heatmapdisc histogram importdatasetfromr importmatrixfromr ipf itsolver kalcvf kalcvs kaldff kaldfs lav lcp lms lp lpsolve lts lupdt marg maxqform mcd milpsolve modulei mve nlpcg nlpdd nlpfdd nlpfea nlphqn nlplm nlpnms nlpnra nlpnrr nlpqn nlpqua nlptr ode odsgraph ortvec pgraf push qntl qr quad queue randgen randseed rdodt rupdt rename rupdt rzlind scatter seq seqscale seqshift seqscale seqshift series solvelin sort sortndx sound spline splinec svd tabulate tpspline tpsplnev tsbaysea tsdecomp tsmlocar tsmlomar tsmulmar tspears tspred tsroot tstvcar tsunimar valset varmacov varmalik varmasim vnormal vtsroot wavft wavget wavift wavprint wavthrsh contained
199e0720cbfSBram Moolenaarsyn region sasIMLFunctionContext start='(' end=')' contained contains=@sasBasicSyntax,sasIMLFunction
200e0720cbfSBram Moolenaarsyn match sasIMLFunction '\v<\w+\ze\(' contained contains=sasIMLFunctionName,sasDataStepFunction nextgroup=sasIMLFunctionContext
201e0720cbfSBram Moolenaarsyn keyword sasIMLControl abort by do else end finish goto if link pause quit resume return run start stop then to until while contained
202e0720cbfSBram Moolenaarsyn keyword sasIMLStatementKeyword append call close closefile create delete display edit file find force free index infile input list load mattrib print purge read remove replace reset save setin setout show sort store summary use window contained
203e0720cbfSBram Moolenaarsyn match sasIMLStatement '\v%(^|;)\s*\zs\h\w*>' display contained contains=sasIMLStatementKeyword,sasGlobalStatementKeyword
204e0720cbfSBram Moolenaarsyn match sasIMLStatement '\v%(^|;)\s*\zsods>' display contained contains=sasGlobalStatementKeyword nextgroup=sasGlobalStatementODSKeyword skipwhite skipnl skipempty
205e0720cbfSBram Moolenaarsyn region sasIML matchgroup=sasSectionKeyword start='\v%(^|;)\s*\zsproc\s+iml>' end='\v%(^|;)\s*%(quit|data|proc|endsas)>'me=s-1 fold contains=@sasBasicSyntax,sasIMLFunction,sasIMLControl,sasIMLStatement
206071d4279SBram Moolenaar
207e0720cbfSBram Moolenaar" Macro definition
208e0720cbfSBram Moolenaarsyn region sasMacro start='\v\%macro>' end='\v\%mend>' fold keepend contains=@sasBasicSyntax,@sasDataStepSyntax,sasDataStep,sasProc,sasODSGraphicsProc,sasGraphProc,sasAnalyticalProc,sasProcTemplate,sasProcSQL,sasDS2,sasIML
209071d4279SBram Moolenaar
210e0720cbfSBram Moolenaar" Define default highlighting
211e0720cbfSBram Moolenaarhi def link sasComment Comment
212e0720cbfSBram Moolenaarhi def link sasTodo Delimiter
213e0720cbfSBram Moolenaarhi def link sasSectLbl Title
214e0720cbfSBram Moolenaarhi def link sasSectLblEnds Comment
215e0720cbfSBram Moolenaarhi def link sasNumber Number
216e0720cbfSBram Moolenaarhi def link sasDateTime Constant
217e0720cbfSBram Moolenaarhi def link sasString String
218e0720cbfSBram Moolenaarhi def link sasDataStepControl Keyword
219e0720cbfSBram Moolenaarhi def link sasProcTemplateClause Keyword
220e0720cbfSBram Moolenaarhi def link sasProcSQLClause Keyword
221e0720cbfSBram Moolenaarhi def link sasDS2Control Keyword
222e0720cbfSBram Moolenaarhi def link sasIMLControl Keyword
223e0720cbfSBram Moolenaarhi def link sasOperator Operator
224e0720cbfSBram Moolenaarhi def link sasGlobalStatementKeyword Statement
225e0720cbfSBram Moolenaarhi def link sasGlobalStatementODSKeyword Statement
226e0720cbfSBram Moolenaarhi def link sasSectionKeyword Statement
227e0720cbfSBram Moolenaarhi def link sasDataStepFunctionName Function
228e0720cbfSBram Moolenaarhi def link sasDataStepCallRoutineName Function
229e0720cbfSBram Moolenaarhi def link sasDataStepStatementKeyword Statement
230e0720cbfSBram Moolenaarhi def link sasDataStepStatementHashKeyword Statement
231e0720cbfSBram Moolenaarhi def link sasDataStepHashOperator Operator
232e0720cbfSBram Moolenaarhi def link sasDataStepHashMethodName Function
233e0720cbfSBram Moolenaarhi def link sasDataStepHashAttributeName Identifier
234e0720cbfSBram Moolenaarhi def link sasProcStatementKeyword Statement
235e0720cbfSBram Moolenaarhi def link sasODSGraphicsProcStatementKeyword Statement
236e0720cbfSBram Moolenaarhi def link sasGraphProcStatementKeyword Statement
237e0720cbfSBram Moolenaarhi def link sasAnalyticalProcStatementKeyword Statement
238e0720cbfSBram Moolenaarhi def link sasProcTemplateStatementKeyword Statement
239e0720cbfSBram Moolenaarhi def link sasProcTemplateStatementComplexKeyword Statement
240e0720cbfSBram Moolenaarhi def link sasProcTemplateGTLStatementKeyword Statement
241e0720cbfSBram Moolenaarhi def link sasProcTemplateGTLComplexKeyword Statement
242e0720cbfSBram Moolenaarhi def link sasProcSQLFunctionName Function
243e0720cbfSBram Moolenaarhi def link sasProcSQLStatementKeyword Statement
244e0720cbfSBram Moolenaarhi def link sasProcSQLStatementComplexKeyword Statement
245e0720cbfSBram Moolenaarhi def link sasProcSQLStatementNextKeyword Statement
246e0720cbfSBram Moolenaarhi def link sasDS2FunctionName Function
247e0720cbfSBram Moolenaarhi def link sasDS2StatementKeyword Statement
248e0720cbfSBram Moolenaarhi def link sasIMLFunctionName Function
249e0720cbfSBram Moolenaarhi def link sasIMLCallRoutineName Function
250e0720cbfSBram Moolenaarhi def link sasIMLStatementKeyword Statement
251e0720cbfSBram Moolenaarhi def link sasMacroReserved PreProc
252e0720cbfSBram Moolenaarhi def link sasMacroVariable Define
253e0720cbfSBram Moolenaarhi def link sasMacroFunctionName Define
254e0720cbfSBram Moolenaarhi def link sasDataLine SpecialChar
255e0720cbfSBram Moolenaarhi def link sasFormat SpecialChar
256e0720cbfSBram Moolenaarhi def link sasReserved Special
257071d4279SBram Moolenaar
258071d4279SBram Moolenaar" Syncronize from beginning to keep large blocks from losing
259071d4279SBram Moolenaar" syntax coloring while moving through code.
260071d4279SBram Moolenaarsyn sync fromstart
261071d4279SBram Moolenaar
262071d4279SBram Moolenaarlet b:current_syntax = "sas"
263071d4279SBram Moolenaar
264e0720cbfSBram Moolenaarlet &cpo = s:cpo_save
265e0720cbfSBram Moolenaarunlet s:cpo_save
266