Your SAS programs, embedded in web apps and elsewhere

Is there a way to Append an Apostrophe?

Accepted Solution Solved
Reply
Super Contributor
Posts: 480
Accepted Solution

Is there a way to Append an Apostrophe?

In SAS 9.2 Is there a way to append an Apostrophe?

%macro testMacro();

            %let apostrophe = %str(');

            %let sumLevText = "1";

            %let sumLevText = &apostrophe.&sumLevText.&apostrophe;

%mend;

%testMacro();

I’m thinking that it has something to do with using quote() but I’m not sure.


I’m trying to transform

1, 2, 3 to ‘1’, ‘2,’ ‘3’ I can split the string but adding the apostrophe causes errors.


Accepted Solutions
Solution
‎05-27-2015 03:59 PM
Trusted Advisor
Posts: 1,300

Re: Is there a way to Append an Apostrophe?

%let apostrophe=%str(%'); *you should properly escape it;

%let sumLevText = 1; *don't use "'s;

%let sumLevText = &apostrophe.&sumLevText.&apostrophe.;

%put >>>&sumLevText.;

View solution in original post


All Replies
Solution
‎05-27-2015 03:59 PM
Trusted Advisor
Posts: 1,300

Re: Is there a way to Append an Apostrophe?

%let apostrophe=%str(%'); *you should properly escape it;

%let sumLevText = 1; *don't use "'s;

%let sumLevText = &apostrophe.&sumLevText.&apostrophe.;

%put >>>&sumLevText.;

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 258 views
  • 0 likes
  • 2 in conversation