<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to resolve quoted string containing quoted words in a macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-quoted-string-containing-quoted-words-in-a-macro/m-p/668904#M200566</link>
    <description>&lt;P&gt;Try either:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;item = %str('Med terms "Neoplasm progression", "Malignant progression" and "Disease progression" drug are excluded.') ;
/* replace open&amp;amp;close from double quotes to single quotes */&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;item = %str("Med terms ""Neoplasm progression"", ""Malignant progression"" and ""Disease progression"" drug are excluded.") ;
/* double each internal double quote ot replace it to single quotes *.

item = %str("Med terms 'Neoplasm progression', 'Malignant progression' and 'Disease progression' drug are excluded.") ;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 13 Jul 2020 18:18:55 GMT</pubDate>
    <dc:creator>Shmuel</dc:creator>
    <dc:date>2020-07-13T18:18:55Z</dc:date>
    <item>
      <title>How to resolve quoted string containing quoted words in a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-quoted-string-containing-quoted-words-in-a-macro/m-p/668901#M200564</link>
      <description>&lt;P&gt;Dear,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying create a variable having quoted words. Please suggest. Thank you&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the macro &lt;FONT color="#FF6600"&gt;one&lt;/FONT&gt;, the&lt;FONT color="#FF6600"&gt; item&lt;/FONT&gt; variable is not created. Please suggest. Thank you&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data one;
input want $;
datalines;
aaaaaaa
;
run;


%macro one;
data two;
length item $200.;
set one;
item = %str("Med terms "Neoplasm progression", "Malignant progression" and "Disease progression" drug are excluded.") ;
run;
%mend;

%one;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Jul 2020 18:12:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-quoted-string-containing-quoted-words-in-a-macro/m-p/668901#M200564</guid>
      <dc:creator>knveraraju91</dc:creator>
      <dc:date>2020-07-13T18:12:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to resolve quoted string containing quoted words in a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-quoted-string-containing-quoted-words-in-a-macro/m-p/668902#M200565</link>
      <description>&lt;P&gt;In DATA TWO, you have&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;item = %str("Med terms "Neoplasm progression", "Malignant progression" and "Disease progression" drug are excluded.") ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But ITEM is a data set variable, not a macro variable. %STR() shgouldn't be used to create data set variables. Just create ITEM using whatever text strings you want using proper DATA step syntax for creating character strings.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In fact, your macros are meaningless in this code, they add no value. Get the code to work without macros and without macro variables.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jul 2020 18:19:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-quoted-string-containing-quoted-words-in-a-macro/m-p/668902#M200565</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-07-13T18:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to resolve quoted string containing quoted words in a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-quoted-string-containing-quoted-words-in-a-macro/m-p/668904#M200566</link>
      <description>&lt;P&gt;Try either:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;item = %str('Med terms "Neoplasm progression", "Malignant progression" and "Disease progression" drug are excluded.') ;
/* replace open&amp;amp;close from double quotes to single quotes */&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;item = %str("Med terms ""Neoplasm progression"", ""Malignant progression"" and ""Disease progression"" drug are excluded.") ;
/* double each internal double quote ot replace it to single quotes *.

item = %str("Med terms 'Neoplasm progression', 'Malignant progression' and 'Disease progression' drug are excluded.") ;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Jul 2020 18:18:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-quoted-string-containing-quoted-words-in-a-macro/m-p/668904#M200566</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2020-07-13T18:18:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to resolve quoted string containing quoted words in a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-quoted-string-containing-quoted-words-in-a-macro/m-p/668909#M200568</link>
      <description>&lt;P&gt;What value does using %STR() add?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How about this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;item='Med terms "Neoplasm progression", "Malignant progression" and "Disease progression" drug are excluded.';
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Jul 2020 18:29:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-quoted-string-containing-quoted-words-in-a-macro/m-p/668909#M200568</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-07-13T18:29:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to resolve quoted string containing quoted words in a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-quoted-string-containing-quoted-words-in-a-macro/m-p/668915#M200572</link>
      <description>&lt;P&gt;I don't see where you are planning to use macro variables.&lt;/P&gt;
&lt;P&gt;Your code is attempting to define the variable ITEM in the dataset TWO, but it is using the wrong syntax for specifying a string that includes quotes.&lt;/P&gt;
&lt;P&gt;Either use a different character on the outside.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;'Med terms "Neoplasm progression", "Malignant progression" and "Disease progression" drug are excluded.'

"Med terms 'Neoplasm progression', 'Malignant progression' and 'Disease progression' drug are excluded."&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or double any embedded quotes.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;"Med terms ""Neoplasm progression"", ""Malignant progression"" and ""Disease progression"" drug are excluded."&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you actually had a macro variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let terms=Med terms "Neoplasm progression", "Malignant progression" and "Disease progression" drug are excluded.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And you wanted to use it to generate your string use the QUOTE() function.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;items=%sysfunc(quote(&amp;amp;terms));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If the macro variable has unbalanced quotes then add macro quoting to it. Or add it before passing the value to QUOTE().&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;items=%sysfunc(quote(%superq(terms)));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Jul 2020 18:32:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-quoted-string-containing-quoted-words-in-a-macro/m-p/668915#M200572</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-07-13T18:32:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to resolve quoted string containing quoted words in a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-quoted-string-containing-quoted-words-in-a-macro/m-p/668963#M200607</link>
      <description>&lt;P&gt;You don't need a macro definition, and you don't need the %STR function..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Solve your issue by using single quotes around your string, as already proposed.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jul 2020 20:54:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-quoted-string-containing-quoted-words-in-a-macro/m-p/668963#M200607</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-07-13T20:54:57Z</dc:date>
    </item>
  </channel>
</rss>

