Macro Functions Listed by Product

Base SAS

B E I K L N Q R S U V

Name
Syntax and Description
%BQUOTE(character-string | text-expression)
%NRBQUOTE(character-string | text-expression)
Mask special characters and mnemonic operators in a resolved value at macro execution.
Product: Base SAS
Document: SAS Macro Language: Reference
%EVAL(arithmetic | logical-expression)
Evaluates arithmetic and logical expressions using integer arithmetic.
Product: Base SAS
Document: SAS Macro Language: Reference
%INDEX(source, string)
Returns the position of the first character of a string.
Product: Base SAS
Document: SAS Macro Language: Reference
%KCMPRES (text | text expression)
%QKCMPRES (text | text expression)
Compresses multiple blanks and removes leading and trailing blanks.
Product: Base SAS
Document: SAS National Language Support (NLS): Reference Guide
%KINDEX (source, string)
Returns the position of the first character of a string.
Product: Base SAS
Document: SAS National Language Support (NLS): Reference Guide
%KLEFT (text | text expression)
%QKLEFT (text | text expression)
Left-aligns an argument by removing leading blanks.
Product: Base SAS
Document: SAS National Language Support (NLS): Reference Guide
%KLENGTH (character string | text expression)
Returns the length of a string.
Product: Base SAS
Document: SAS National Language Support (NLS): Reference Guide
%KSCAN (argument, n<,delimiters > )
%QKSCAN (argument, n<,delimiters > )
Search for a word that is specified by its position in a string.
Product: Base SAS
Document: SAS National Language Support (NLS): Reference Guide
%KSUBSTR (argument, position<, length> )
%QKSUBSTR (argument, position<, length> )
Produce a substring of a character string.
Product: Base SAS
Document: SAS National Language Support (NLS): Reference Guide
%KUPCASE (character string | text expression)
%QKUPCASE (character string | text expression)
Convert values to uppercase.
Product: Base SAS
Document: SAS National Language Support (NLS): Reference Guide
%LENGTH(character-string | text-expression)
Returns the length of a string.
Product: Base SAS
Document: SAS Macro Language: Reference
%NRBQUOTE(character-string | text-expression)
Masks special characters, including & and %, and mnemonic operators in a resolved value at macro execution.
Product: Base SAS
Document: SAS Macro Language: Reference
%NRQUOTE(character-string | text-expression)
Masks special characters, including & and %, and mnemonic operators in a resolved value at macro execution.
Product: Base SAS
Document: SAS Macro Language: Reference
%NRSTR(character-string)
Masks special characters, including & and %, and mnemonic operators in constant text during macro compilation.
Product: Base SAS
Document: SAS Macro Language: Reference
%QSCAN(argument,n<,charlist<,modifiers> >)
Searches for a word and masks special characters and mnemonic operators.
Product: Base SAS
Document: SAS Macro Language: Reference
%QSUBSTR(argument, position<, length>)
Produces a substring and masks special characters and mnemonic operators.
Product: Base SAS
Document: SAS Macro Language: Reference
%QSYSFUNC(function(argument(s))<, format>)
Executes functions and masks special characters and mnemonic operators.
Product: Base SAS
Document: SAS Macro Language: Reference
%QUOTE(character-string | text-expression)
%NRQUOTE(character-string | text-expression)
Mask special characters and mnemonic operators in a resolved value at macro execution.
Product: Base SAS
Document: SAS Macro Language: Reference
%QUPCASE(character-string | text-expression)
Converts a value to uppercase and returns a result that masks special characters and mnemonic operators.
Product: Base SAS
Document: SAS Macro Language: Reference
RESOLVE(argument)
Resolves the value of a text expression during DATA step execution.
Product: Base SAS
Document: SAS Macro Language: Reference
%SCAN(argument, n<,charlist <,modifiers> >)
%QSCAN(argument, n<,charlist <,modifiers> >)
Search for a word that is specified by its position in a string.
Product: Base SAS
Document: SAS Macro Language: Reference
%STR(character-string)
%NRSTR(character-string)
Mask special characters and mnemonic operators in constant text at macro compilation.
Product: Base SAS
Document: SAS Macro Language: Reference
%SUBSTR(argument, position<, length>)
%QSUBSTR(argument, position<, length>)
Produce a substring of a character string.
Product: Base SAS
Document: SAS Macro Language: Reference
%SUPERQ(argument)
Masks all special characters and mnemonic operators at macro execution but prevents further resolution of the value.
Product: Base SAS
Document: SAS Macro Language: Reference
SYMEXIST(argument)
Returns an indication of the existence of a macro variable.
Product: Base SAS
Document: SAS Macro Language: Reference
%SYMEXIST(macro-variable-name)
Returns an indication of the existence of a macro variable.
Product: Base SAS
Document: SAS Macro Language: Reference
SYMGET(argument)
Returns the value of a macro variable to the DATA step during DATA step execution.
Product: Base SAS
Document: SAS Macro Language: Reference
SCL-variable=SYMGETN('macro-variable');
In SAS Component Control Language (SCL) programs, returns the value of a global macro variable as a numeric value.
Product: Base SAS
Document: SAS Macro Language: Reference
SYMGLOBL(argument)
Returns an indication as to whether a macro variable is global in scope to the DATA step during DATA step execution.
Product: Base SAS
Document: SAS Macro Language: Reference
%SYMGLOBL(macro-variable-name)
Returns an indication as to whether a macro variable is global in scope.
Product: Base SAS
Document: SAS Macro Language: Reference
SYMLOCAL(argument)
Returns an indication as to whether a macro variable is local in scope to the DATA step during DATA step execution.
Product: Base SAS
Document: SAS Macro Language: Reference
%SYMLOCAL(macro-variable-name)
Returns an indication as to whether a macro variable is local in scope.
Product: Base SAS
Document: SAS Macro Language: Reference
%SYSEVALF(expression<, conversion-type>)
Evaluates arithmetic and logical expressions using floating-point arithmetic.
Product: Base SAS
Document: SAS Macro Language: Reference
%SYSFUNC(function(argument(s))<, format>)
%QSYSFUNC(function(argument(s))<, format>)
Execute SAS functions or user-written functions.
Product: Base SAS
Document: SAS Macro Language: Reference
%SYSGET(environment-variable)
Returns the value of the specified operating environment variable.
Product: Base SAS
Document: SAS Macro Language: Reference
%SYSMACEXEC(macro_name)
Returns an indication of the execution status of a macro.
Product: Base SAS
Document: SAS Macro Language: Reference
%SYSMACEXIST(macro-name)
Returns an indication of the existence of a macro definition in the Work.SASMacr or the Work.SASMacn catalog. Otherwise, the returned value is 0.
Product: Base SAS
Document: SAS Macro Language: Reference
%SYSMEXECDEPTH
Returns the nesting depth of macro execution from the point of the call to %SYSMEXECDEPTH.
Product: Base SAS
Document: SAS Macro Language: Reference
%SYSMEXECNAME(n)
Returns the name of the macro executing at a requested nesting level.
Product: Base SAS
Document: SAS Macro Language: Reference
%SYSPROD(product)
Reports whether a SAS software product is licensed at the site.
Product: Base SAS
Document: SAS Macro Language: Reference
%UNQUOTE(character-string | text-expression)
During macro execution, unmasks all special characters and mnemonic operators for a value.
Product: Base SAS
Document: SAS Macro Language: Reference
%UPCASE(character-string | text-expression)
%QUPCASE(character-string | text-expression)
Convert values to uppercase.
Product: Base SAS
Document: SAS Macro Language: Reference
%VALIDCHS(dsnm=dataset_name, libnm=libref_name<ENCODING=encoding_name,><COMPATIBLE=encoding_name)>
Validates the character(s) encoding compatibility for data set variables.
Product: Base SAS
Document: SAS National Language Support (NLS): Reference Guide

SAS/GRAPH

C H R

Name
Syntax and Description
%CMY(cyan, magenta, yellow);
creates an RGB color name from numeric CMY component values.
Product: SAS/GRAPH
Document: SAS/GRAPH: Reference
%CMYK(cyan, magenta, yellow, black);
creates a CMYK color name from numeric CMYK component values.
Product: SAS/GRAPH
Document: SAS/GRAPH: Reference
%CNS(CNS-color-name);
creates a SAS/GRAPH HLS color name from a color-naming scheme (CNS) color name.
Product: SAS/GRAPH
Document: SAS/GRAPH: Reference
%HLS(hue, lightness, saturation);
creates an HLS color name from numeric HLS component values.
Product: SAS/GRAPH
Document: SAS/GRAPH: Reference
%HLS2RGB(HLS-color-name);
creates an RGB color name from an HLS color name.
Product: SAS/GRAPH
Document: SAS/GRAPH: Reference
%HSV(hue, saturation, value);
creates an HLS color name from numeric HSV component values.
Product: SAS/GRAPH
Document: SAS/GRAPH: Reference
%RGB(red, green, blue);
creates an RBG color name from numeric RGB component values.
Product: SAS/GRAPH
Document: SAS/GRAPH: Reference
%RGB2HLS(RGB-color-name);
creates an HLS color name from an RGB color name.
Product: SAS/GRAPH
Document: SAS/GRAPH: Reference
Last updated: March 30, 2026