- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi Experts,
this is have:
%let string=i need apostrophe instead of question mark?ed
want:
i need apostrophe instead of question mark'ed
i am using below
data t;
var="&string";
var1=tranwrd(trim(var),"?",",");
call symput("want",var1);
run;
%put &want;
i am getting error :Literal contains unmatched quote.
Thanks
Sam
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
If you are successful you will create a macro variable with and un-quoted single quote. This will need special attention depending on what you do next.
It is probably better to quote the unmatched single quote with %str((%');
33 %put NOTE: &=string;
NOTE: STRING=i need apostrophe instead of question mark'ed
data _null_;
var="&string";
var1=transtrn(trim(var),"?","'");
call symput("want",var1);
run;
%put %bquote(&want);
32 %let string=i need apostrophe instead of question mark?ed;
35 data _null_;
36 var="&string";
37 var1=transtrn(trim(var),"?","'");
38 call symput("want",var1);
39 run;
40
41 %put %bquote(&want);
i need apostrophe instead of question mark'ed
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Your code should work.
Please post the complete log
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
If you are successful you will create a macro variable with and un-quoted single quote. This will need special attention depending on what you do next.
It is probably better to quote the unmatched single quote with %str((%');
33 %put NOTE: &=string;
NOTE: STRING=i need apostrophe instead of question mark'ed
data _null_;
var="&string";
var1=transtrn(trim(var),"?","'");
call symput("want",var1);
run;
%put %bquote(&want);
32 %let string=i need apostrophe instead of question mark?ed;
35 data _null_;
36 var="&string";
37 var1=transtrn(trim(var),"?","'");
38 call symput("want",var1);
39 run;
40
41 %put %bquote(&want);
i need apostrophe instead of question mark'ed
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you data _null_. I was not successful at first macro variable itself. so i am getting issue.
Thanks
Sam