Home > OS >  Remove quotes from a macro variable
Remove quotes from a macro variable

Time:03-23

I'm new to SAS programming and I'm trying to change the value of some macro variables.

I have parameters in my programs where you can insert 2 product codes, for example '12345', '54321', you have to enter them that way literally, with quotes and everything.

Those values are stored in a &product macrovariable, so if we do a %put &product; would return us '12345','54321'.

What I want to do is remove those quotes that are in the middle and that results in '12345,54321'

I have tried to do this:

%let producto = '12345','54321';
%let product = %sysfunc(tranwrd(&producto,"'"," "));

ERROR: The function TRANWRD referenced by the %SYSFUNC or %QSYSFUNC macro function has too many arguments.

but it tells me that tranwrd has many arguments, does anyone know why? Thank you

CodePudding user response:

You need to quote the commas in producto.

%superq(PRODUCTO)

Also the second and third argument are incorrect for %SYSFUNC

%str(%'),%str( )
  • Related