Hi!
For some reason the first parameter reads the whole string is not separated by a comma. How can I solve this?
%macro mmm(p_aram,p_aram2);
%put >>> &p_aram.;
%put >>> &p_aram2.;
%mend;
%let x="x,y";
%let x = %qsysfunc(compress(&x,%str(%")));
%put &x.;
%mmm(%str(&x.));
I want p_aram = x p_aram2 = y
Thanks!
Use Sysfunc instead of Qsysfunc
%macro mmm(p_aram,p_aram2);
%put >>> &p_aram.;
%put >>> &p_aram2.;
%mend;
%let x="x,y";
%let x = %sysfunc(compress(&x,%str(%")));
%put &x.;
%mmm(%str(&x.));
Use Sysfunc instead of Qsysfunc
%macro mmm(p_aram,p_aram2);
%put >>> &p_aram.;
%put >>> &p_aram2.;
%mend;
%let x="x,y";
%let x = %sysfunc(compress(&x,%str(%")));
%put &x.;
%mmm(%str(&x.));
Anytime 🙂
Sounds like the issue is you are macro quoting the value, so the comma is "protected".
%let x="x,y";
%mmm(%sysfunc(dequote(&x)));
Is there some reason why you thought you needed to add macro quoting?
In that case use %QSCAN() to pick off the first and second values.
%let x="x,y";
%let x=%qsysfunc(dequote(&x));
%mmm(%qscan(&x,1,%str(,)) , %qscan(&x,2,%str(,));
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.