3 " Maintainer: James Kidd <james.kidd@covance.com>
4 " Last Change: 02 May 2001
5 " Added keywords for use in SAS log files and region definition
6 " for SAS macro variable hi-lighting
7 " For version 5.x: Clear all syntax items
8 " For version 6.x: Quit when a syntax file was already loaded
11 elseif exists("b:current_syntax")
17 syn region sasString start=+"+ skip=+\\\\\|\\"+ end=+"+
18 syn region sasString start=+'+ skip=+\\\\\|\\"+ end=+'+
20 syn match sasNumber "-\=\<\d*\.\=[0-9_]\>"
22 syn region sasComment start="/\*" end="\*/"
23 syn match sasComment "^\s*\*.*;"
25 " This line defines macro variables in code. HiLink at end of file
26 " defines the color scheme. Begin region with ampersand and end with
27 " any non-word character offset by -1; put ampersand in the skip list
28 " just in case it is used to concatenate macro variable values.
29 syn region sasMacroVar start="\&" skip="[_&]" end="\W"he=e-1
31 syn keyword sasStep RUN QUIT
32 syn match sasStep "^\s*DATA\s"
33 syn match sasStep "^\s*PROC\s"
35 syn keyword sasConditional DO ELSE END IF THEN UNTIL WHILE
37 syn keyword sasStatement ABORT ARRAY ATTRIB BY CALL CARDS CARDS4 CATNAME
38 syn keyword sasStatement CONTINUE DATALINES DATALINES4 DELETE DISPLAY
39 syn keyword sasStatement DM DROP ENDSAS ERROR FILE FILENAME FOOTNOTE
40 syn keyword sasStatement FORMAT GOTO INFILE INFORMAT INPUT KEEP
41 syn keyword sasStatement LABEL LEAVE LENGTH LIBNAME LINK LIST LOSTCARD
42 syn keyword sasStatement MERGE MISSING MODIFY OPTIONS OUTPUT PAGE
43 syn keyword sasStatement PUT REDIRECT REMOVE RENAME REPLACE RETAIN
44 syn keyword sasStatement RETURN SELECT SET SKIP STARTSAS STOP TITLE
45 syn keyword sasStatement UPDATE WAITSAS WHERE WINDOW X
47 syn match sasStatement "FOOTNOTE\d"
48 syn match sasStatement "TITLE\d"
50 syn match sasMacro "%BQUOTE"
51 syn match sasMacro "%NRBQUOTE"
52 syn match sasMacro "%CMPRES"
53 syn match sasMacro "%QCMPRES"
54 syn match sasMacro "%COMPSTOR"
55 syn match sasMacro "%DATATYP"
56 syn match sasMacro "%DISPLAY"
57 syn match sasMacro "%DO"
58 syn match sasMacro "%ELSE"
59 syn match sasMacro "%END"
60 syn match sasMacro "%EVAL"
61 syn match sasMacro "%GLOBAL"
62 syn match sasMacro "%GOTO"
63 syn match sasMacro "%IF"
64 syn match sasMacro "%INDEX"
65 syn match sasMacro "%INPUT"
66 syn match sasMacro "%KEYDEF"
67 syn match sasMacro "%LABEL"
68 syn match sasMacro "%LEFT"
69 syn match sasMacro "%LENGTH"
70 syn match sasMacro "%LET"
71 syn match sasMacro "%LOCAL"
72 syn match sasMacro "%LOWCASE"
73 syn match sasMacro "%MACRO"
74 syn match sasMacro "%MEND"
75 syn match sasMacro "%NRBQUOTE"
76 syn match sasMacro "%NRQUOTE"
77 syn match sasMacro "%NRSTR"
78 syn match sasMacro "%PUT"
79 syn match sasMacro "%QCMPRES"
80 syn match sasMacro "%QLEFT"
81 syn match sasMacro "%QLOWCASE"
82 syn match sasMacro "%QSCAN"
83 syn match sasMacro "%QSUBSTR"
84 syn match sasMacro "%QSYSFUNC"
85 syn match sasMacro "%QTRIM"
86 syn match sasMacro "%QUOTE"
87 syn match sasMacro "%QUPCASE"
88 syn match sasMacro "%SCAN"
89 syn match sasMacro "%STR"
90 syn match sasMacro "%SUBSTR"
91 syn match sasMacro "%SUPERQ"
92 syn match sasMacro "%SYSCALL"
93 syn match sasMacro "%SYSEVALF"
94 syn match sasMacro "%SYSEXEC"
95 syn match sasMacro "%SYSFUNC"
96 syn match sasMacro "%SYSGET"
97 syn match sasMacro "%SYSLPUT"
98 syn match sasMacro "%SYSPROD"
99 syn match sasMacro "%SYSRC"
100 syn match sasMacro "%SYSRPUT"
101 syn match sasMacro "%THEN"
102 syn match sasMacro "%TRIM"
103 syn match sasMacro "%UNQUOTE"
104 syn match sasMacro "%UNTIL"
105 syn match sasMacro "%UPCASE"
106 syn match sasMacro "%VERIFY"
107 syn match sasMacro "%WHILE"
108 syn match sasMacro "%WINDOW"
112 syn keyword sasFunction ABS ADDR AIRY ARCOS ARSIN ATAN ATTRC ATTRN
113 syn keyword sasFunction BAND BETAINV BLSHIFT BNOT BOR BRSHIFT BXOR
114 syn keyword sasFunction BYTE CDF CEIL CEXIST CINV CLOSE CNONCT COLLATE
115 syn keyword sasFunction COMPBL COMPOUND COMPRESS COS COSH CSS CUROBS
116 syn keyword sasFunction CV DACCDB DACCDBSL DACCSL DACCSYD DACCTAB
117 syn keyword sasFunction DAIRY DATE DATEJUL DATEPART DATETIME DAY
118 syn keyword sasFunction DCLOSE DEPDB DEPDBSL DEPDBSL DEPSL DEPSL
119 syn keyword sasFunction DEPSYD DEPSYD DEPTAB DEPTAB DEQUOTE DHMS
120 syn keyword sasFunction DIF DIGAMMA DIM DINFO DNUM DOPEN DOPTNAME
121 syn keyword sasFunction DOPTNUM DREAD DROPNOTE DSNAME ERF ERFC EXIST
122 syn keyword sasFunction EXP FAPPEND FCLOSE FCOL FDELETE FETCH FETCHOBS
123 syn keyword sasFunction FEXIST FGET FILEEXIST FILENAME FILEREF FINFO
124 syn keyword sasFunction FINV FIPNAME FIPNAMEL FIPSTATE FLOOR FNONCT
125 syn keyword sasFunction FNOTE FOPEN FOPTNAME FOPTNUM FPOINT FPOS
126 syn keyword sasFunction FPUT FREAD FREWIND FRLEN FSEP FUZZ FWRITE
127 syn keyword sasFunction GAMINV GAMMA GETOPTION GETVARC GETVARN HBOUND
128 syn keyword sasFunction HMS HOSTHELP HOUR IBESSEL INDEX INDEXC
129 syn keyword sasFunction INDEXW INPUT INPUTC INPUTN INT INTCK INTNX
130 syn keyword sasFunction INTRR IRR JBESSEL JULDATE KURTOSIS LAG LBOUND
131 syn keyword sasFunction LEFT LENGTH LGAMMA LIBNAME LIBREF LOG LOG10
132 syn keyword sasFunction LOG2 LOGPDF LOGPMF LOGSDF LOWCASE MAX MDY
133 syn keyword sasFunction MEAN MIN MINUTE MOD MONTH MOPEN MORT N
134 syn keyword sasFunction NETPV NMISS NORMAL NOTE NPV OPEN ORDINAL
135 syn keyword sasFunction PATHNAME PDF PEEK PEEKC PMF POINT POISSON POKE
136 syn keyword sasFunction PROBBETA PROBBNML PROBCHI PROBF PROBGAM
137 syn keyword sasFunction PROBHYPR PROBIT PROBNEGB PROBNORM PROBT PUT
138 syn keyword sasFunction PUTC PUTN QTR QUOTE RANBIN RANCAU RANEXP
139 syn keyword sasFunction RANGAM RANGE RANK RANNOR RANPOI RANTBL RANTRI
140 syn keyword sasFunction RANUNI REPEAT RESOLVE REVERSE REWIND RIGHT
141 syn keyword sasFunction ROUND SAVING SCAN SDF SECOND SIGN SIN SINH
142 syn keyword sasFunction SKEWNESS SOUNDEX SPEDIS SQRT STD STDERR STFIPS
143 syn keyword sasFunction STNAME STNAMEL SUBSTR SUM SYMGET SYSGET SYSMSG
144 syn keyword sasFunction SYSPROD SYSRC SYSTEM TAN TANH TIME TIMEPART
145 syn keyword sasFunction TINV TNONCT TODAY TRANSLATE TRANWRD TRIGAMMA
146 syn keyword sasFunction TRIM TRIMN TRUNC UNIFORM UPCASE USS VAR
147 syn keyword sasFunction VARFMT VARINFMT VARLABEL VARLEN VARNAME
148 syn keyword sasFunction VARNUM VARRAY VARRAYX VARTYPE VERIFY VFORMAT
149 syn keyword sasFunction VFORMATD VFORMATDX VFORMATN VFORMATNX VFORMATW
150 syn keyword sasFunction VFORMATWX VFORMATX VINARRAY VINARRAYX VINFORMAT
151 syn keyword sasFunction VINFORMATD VINFORMATDX VINFORMATN VINFORMATNX
152 syn keyword sasFunction VINFORMATW VINFORMATWX VINFORMATX VLABEL
153 syn keyword sasFunction VLABELX VLENGTH VLENGTHX VNAME VNAMEX VTYPE
154 syn keyword sasFunction VTYPEX WEEKDAY YEAR YYQ ZIPFIPS ZIPNAME ZIPNAMEL
155 syn keyword sasFunction ZIPSTATE
157 " Handy settings for using vim with log files
158 syn keyword sasErrMsg ERROR
159 syn keyword sasWarnMsg WARNING
160 syn keyword sasLogMsg NOTE
162 " End of SAS Functions
164 " Define the default highlighting.
165 " For version 5.7 and earlier: only when not done already
166 " For version 5.8 and later: only when an item doesn't have highlighting yet
168 if version >= 508 || !exists("did_sas_syntax_inits")
170 let did_sas_syntax_inits = 1
171 command -nargs=+ HiLink hi link <args>
173 command -nargs=+ HiLink hi def link <args>
176 HiLink sasComment Comment
177 HiLink sasConditional Statement
178 HiLink sasStep Statement
179 HiLink sasFunction Function
180 HiLink sasMacro PreProc
181 HiLink sasMacroVar NonText
182 HiLink sasNumber Number
183 HiLink sasStatement Statement
184 HiLink sasString String
185 HiLink sasErrMsg ErrorMsg
186 HiLink sasWarnMsg WarningMsg
187 HiLink sasLogMsg MoreMsg
191 let b:current_syntax = "sas"