HTMLDECODE Function

Decodes a string that contains HTML numeric character references or HTML character entity references, and returns the decoded string.

Category: Web Tools
Restriction: I18N Level 2 functions are designed for use with SBCS, DBCS, and MBCS (UTF8).

Syntax

HTMLDECODE(expression)

Required Argument

expression

specifies a character constant, variable, or expression.

Details

The HTMLDECODE function recognizes the following character entity references:
Character Entity Reference
Decoded Character
&
&
<
<
&gt;
>
&quot;
"
&apos;
'
Unrecognized entities (&<name>;) are left unmodified in the output string.
The HTMLDECODE function recognizes numeric entity references that are of the form
&#nnn;
where nnn specifies a decimal number that contains one or more digits.
&#Xnnn;
where nnn specifies a hexadecimal number that contains one or more digits.
Note: Numeric character references that cannot be represented in the current SAS session encoding will not be decoded. The reference will be copied unchanged to the output string.

Example

The following SAS statements produce these results.
SAS Statement
Result
x1=htmldecode('not a &lt;tag&gt;');
not a <tag>
x2=htmldecode('&amp;');
'&'
x3=htmldecode ('&#65;&#66;&#67;');
'ABC'

See Also

Functions: