BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ger15xxhcker
Quartz | Level 8

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!

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

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.));

View solution in original post

4 REPLIES 4
PeterClemmensen
Tourmaline | Level 20

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.));
ger15xxhcker
Quartz | Level 8
Thanks for your help
Tom
Super User Tom
Super User

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(,));

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 505 views
  • 4 likes
  • 3 in conversation