Base SAS has the HTMLENCODE() function, and there is not the same available to Proc DS2, nor Proc FCMP.
The HTTP package does not seem to have anything to do the same.
Is there any way to trick DS2 into using HTMLENCODE?
Example:
The node name needs to be html-encoded in certain situations
%let MAX_LEN_PART = 200 ;
proc ds2 ;
package sasuser.Node / overwrite=yes ;
declare varchar(512) name newname ;
declare package sasuser.Node parent ;
declare package sasuser.Node children ;
declare package sasuser.Node next ;
method init() ;
alias_counter = 0 ;
end ;
method Node(varchar(512) name, package sasuser.Node parent, in_out double alias_count) ;
this.name = name ;
this.newname = name ;
this.parent = parent ;
if verify(name,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789 !#$%&''()+,-.;=@[]^`{}~/') then do ;
this.newname = htmlencode(name, '7bit') ;
put newname= ;
end ;
if length(this.newname) > &MAX_LEN_PART then do ;
alias_count + 1 ;
this.newname = '_migrate_' || put(alias_counter,z4.) ;
put newname= ;
end ;
end ;
method Node(varchar(512) name) ;
this.name = name ;
end ;
method get_path() returns varchar(4096) ;
if null(parent)
then return name ;
else return parent.get_path() || '/' || name ;
end ;
endpackage /* Node */;
data _null_;
enddata;
run ;
quit ;
But the log shows:
ERROR: Compilation error.
ERROR: Unknown function htmlencode.
NOTE: PROC DS2 has set option NOEXEC and will continue to prepare statements.