All,
Wondering whats wrong in the open code that I am trying here:
The following works in a data step
Data Test;
x1 = 'not a <tag>';
x2 = htmldecode(x1);
Run;
However, when I move away from a datastep into open code, this fails(does not return an error, but does not have the desired impact. desired impact/result is demonstrated in data step):
%Global x1 x2;
%let x1 = 'not a <tag>';
%Put &x1;
%let x2 = htmldecode(&x1);
Can somebody kindly explain why ? The desired output is demonstrated in the data step.
The htmlencode function is a data step function. If you want this to work in open (or macro) code you need to wrap it inside a %sysfunc call e.g.
%Global x1 x2;
%let x1 = 'not a <tag>';
%Put &x1;
%let x2 = %sysfunc(htmldecode(&x1));
%put &x2;
You can find more details on how to use %sysfunc here -> http://support.sas.com/documentation/cdl/en/mcrolref/62978/HTML/default/viewer.htm#p1o13d7wb2zfcnn19...
The htmlencode function is a data step function. If you want this to work in open (or macro) code you need to wrap it inside a %sysfunc call e.g.
%Global x1 x2;
%let x1 = 'not a <tag>';
%Put &x1;
%let x2 = %sysfunc(htmldecode(&x1));
%put &x2;
You can find more details on how to use %sysfunc here -> http://support.sas.com/documentation/cdl/en/mcrolref/62978/HTML/default/viewer.htm#p1o13d7wb2zfcnn19...
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.