Substitute text in a macro variable in SAS

10,571

No quotes in a %sysfunc, unless you mean the quote character. (Translate would have hidden the issue, at least, but TRANWRD was looking at &pow and trying to find "." and failing.)

%let pow=0.1;
%let x = %sysfunc(tranwrd(&pow,.,_));
%put x=&x;
Share:
10,571
itzy
Author by

itzy

your about me is currently blank.

Updated on June 17, 2022

Comments

  • itzy
    itzy almost 2 years

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

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

    Output:

    x=0.1

  • B--rian
    B--rian over 3 years
    This post saved my day, in particular the note about the quote character and the %sysfunc...