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...
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.
Ready to level-up your skills? Choose your own adventure.