URLDECODE Function

Returns a string that was decoded using the URL escape syntax.

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

Syntax

URLDECODE(argument)

Required Argument

argument

specifies a character constant, variable, or expression.

Details

Length of Returned Variable in a DATA Step

If the URLDECODE function returns a value to a variable that has not previously been assigned a length, then that variable is given the length of the argument.

The Basics

The URL escape syntax is used to hide characters that might otherwise be significant when used in a URL.
A URL escape sequence can be one of the following:
  • a plus sign, which is replaced by a blank
  • a sequence of three characters beginning with a percent sign and followed by two hexadecimal characters, which is replaced by a single character that has the specified hexadecimal value.
argument can be decoded using either SAS session encoding or UTF-8 encoding. To decode argument by using the SAS session encoding, set the system option URLENCODING=SESSION. To decode argument by using UTF-8 encoding, set the system option URLENCODING=UTF8.
Operating Environment Information: In operating environments that use EBCDIC, SAS performs an extra translation step after it recognizes an escape sequence. The specified character is assumed to be an ASCII encoding. SAS uses the transport-to-local translation table to convert this character to an EBCDIC character in operating environments that use EBCDIC. For more information, see the TRANTAB option .

Example

The following SAS statements produce these results using SAS session decoding.
SAS Statement
Result
x1=urldecode ('abc+def');
put x1;
  
abc def
x2=urldecode ('why%3F');
put x2;
  
why?
x3=urldecode ('%41%42%43%23%31');
put x3;
  
ABC#1

See Also

Functions:
System Options:
URLENCODING= System Option in SAS System Options: Reference