Replace text in macro variable in SAS

I want to change any instances of a period in a macro variable to underline. What am I doing wrong?

%let pow=0.1;
%let x = %sysfunc(tranwrd(&pow,".","_"));
%put x=&x;

Conclusion:

x = 0.1

+5
source share
1 answer

There are no quotes in% sysfunc if you do not mean the quotation mark. (The translation would have hidden the problem, at least, but TRANWRD looked at & pow and tried to find "." And could not.)

%let pow=0.1;
%let x = %sysfunc(tranwrd(&pow,.,_));
%put x=&x;
+8
source

All Articles