<?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: Macro quoting functions in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-quoting-functions/m-p/206878#M38460</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are quotation marks for param &lt;STRONG&gt;"&lt;/STRONG&gt;x (a)&lt;STRONG&gt;"&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 16 Jun 2015 00:04:18 GMT</pubDate>
    <dc:creator>SASSLICK001</dc:creator>
    <dc:date>2015-06-16T00:04:18Z</dc:date>
    <item>
      <title>Macro quoting functions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-quoting-functions/m-p/206876#M38458</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;%let param= "x (a)"; %put ¶m; I need to extract x, how can I achieve this? %let z= %scan(&amp;amp;param,1,'(') ; %put &amp;amp;z; the above code is not working!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jun 2015 23:16:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-quoting-functions/m-p/206876#M38458</guid>
      <dc:creator>SASSLICK001</dc:creator>
      <dc:date>2015-06-15T23:16:38Z</dc:date>
    </item>
    <item>
      <title>Re: Macro quoting functions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-quoting-functions/m-p/206877#M38459</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please try &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let param= x (a);&lt;/P&gt;&lt;P&gt;%let z=%scan(&amp;amp;param,1,' ');&lt;/P&gt;&lt;P&gt;%put &amp;amp;z;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jag&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jun 2015 23:25:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-quoting-functions/m-p/206877#M38459</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2015-06-15T23:25:52Z</dc:date>
    </item>
    <item>
      <title>Re: Macro quoting functions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-quoting-functions/m-p/206878#M38460</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are quotation marks for param &lt;STRONG&gt;"&lt;/STRONG&gt;x (a)&lt;STRONG&gt;"&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2015 00:04:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-quoting-functions/m-p/206878#M38460</guid>
      <dc:creator>SASSLICK001</dc:creator>
      <dc:date>2015-06-16T00:04:18Z</dc:date>
    </item>
    <item>
      <title>Re: Macro quoting functions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-quoting-functions/m-p/206879#M38461</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Lets put this way&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let param= "x y (a)";&amp;nbsp; &lt;/P&gt;&lt;P&gt;I need to extract &lt;STRONG&gt;x y&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;%let z= %scan(&amp;amp;param,1,'(') ;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;I am using '(' as delimiter but I think I have to %UNQUOTE, %BQUOTE etc to work properly&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2015 00:07:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-quoting-functions/m-p/206879#M38461</guid>
      <dc:creator>SASSLICK001</dc:creator>
      <dc:date>2015-06-16T00:07:27Z</dc:date>
    </item>
    <item>
      <title>Re: Macro quoting functions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-quoting-functions/m-p/206880#M38462</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First, you have to understand the values you have assigned.&amp;nbsp; This statement assigns &amp;amp;PARAM a total of 7 characters:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let param = "x (a)";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you wanted to assign the 5 characters within the quotes, you would just code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let param = x (a);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Given that you used double quotes, x is the second character.&amp;nbsp; You could extract it using:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let z = %scan(&amp;amp;param, " ");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But that's actually a trick.&amp;nbsp; It specifies that %SCAN should use both blanks and double quotes as delimiters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Given your second test:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let param = "x y (a)";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This assigns &amp;amp;PARAM a total of 9 characters, where x is the second character.&amp;nbsp; If you only wanted the characters within quotes, you should have used:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let param = x y (a);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With &amp;amp;PARAM taking on 9 characters, you could use:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let z = %scan(&amp;amp;param, "(" );&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Again, this is a trick,&amp;nbsp; it says that %SCAN should use double quotes as well as left-hand parentheses as delimiters.&amp;nbsp; Repeating the double quote in the second parameter of %SCAN prevents having unbalanced quotes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So the first question to consider is, did you mean to add the double quotes to the value of &amp;amp;PARAM?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck,.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2015 00:35:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-quoting-functions/m-p/206880#M38462</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-06-16T00:35:13Z</dc:date>
    </item>
    <item>
      <title>Re: Macro quoting functions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-quoting-functions/m-p/206881#M38463</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes param has double quotes!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2015 00:44:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-quoting-functions/m-p/206881#M38463</guid>
      <dc:creator>SASSLICK001</dc:creator>
      <dc:date>2015-06-16T00:44:08Z</dc:date>
    </item>
    <item>
      <title>Re: Macro quoting functions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-quoting-functions/m-p/206882#M38464</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I just gav you the example my data is coming up with the quotations, so I have to remove the quotation marks and then extract the first string&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2015 00:46:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-quoting-functions/m-p/206882#M38464</guid>
      <dc:creator>SASSLICK001</dc:creator>
      <dc:date>2015-06-16T00:46:11Z</dc:date>
    </item>
    <item>
      <title>Re: Macro quoting functions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-quoting-functions/m-p/206883#M38465</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use the DEQUOTE() function to remove the quotes.&amp;nbsp; Also has the advantage or de-duping the doubled up embedded quotes and also working fine when the values does not contain quotes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let param="x (a)" ;&lt;/P&gt;&lt;P&gt;%let param_clean = %sysfunc(dequote(&amp;amp;param));&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2015 01:19:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-quoting-functions/m-p/206883#M38465</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-06-16T01:19:44Z</dc:date>
    </item>
    <item>
      <title>Re: Macro quoting functions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-quoting-functions/m-p/206884#M38466</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So this version will do it:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let z = %scan(&amp;amp;param, " ");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The %SCAN function here is using both blanks and double quotes as delimiters.&amp;nbsp; You don't need to remove the double quotes ... just have %SCAN treat them delimiters.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2015 01:19:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-quoting-functions/m-p/206884#M38466</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-06-16T01:19:46Z</dc:date>
    </item>
    <item>
      <title>Re: Macro quoting functions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-quoting-functions/m-p/206885#M38467</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Very interesting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #353535; font-family: Lato, sans-serif; font-size: 14px;"&gt;&lt;/P&gt;&lt;H3&gt;Code: Program&lt;/H3&gt;&lt;PRE class="sce-render" style="font-family: 'Courier New', Menlo, 'Lucida Console'; font-size: 16px;"&gt;&lt;SPAN class="macro-keyword" style="color: #0000ff;"&gt;%let&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;param&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string" style="color: #800080;"&gt;"x (a)"&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="macro-keyword" style="color: #0000ff;"&gt;%let&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;param_clean&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="macro-keyword" style="color: #0000ff;"&gt;%scan&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;param&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;1&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;ka&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN class="macro-keyword" style="color: #0000ff;"&gt;%put&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;param&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="macro-keyword" style="color: #0000ff;"&gt;%put&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;param_clean&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #353535; font-family: Lato, sans-serif; font-size: 14px;"&gt;&lt;/P&gt;&lt;HR /&gt;&lt;H3&gt;Log: Program&lt;/H3&gt;&lt;DIV class="sasSource" style="color: #000000;"&gt; 1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;P&gt;&lt;/P&gt;&lt;P class="sasSource" style="color: #000000;"&gt; 57&amp;nbsp; &lt;/P&gt;&lt;P class="sasSource" style="color: #000000;"&gt; 58 %let param="x (a)" ;&lt;/P&gt;&lt;P class="sasSource" style="color: #000000;"&gt; 59 %let param_clean = %scan(&amp;amp;param,1,,ka);&lt;/P&gt;&lt;P class="sasSource" style="color: #000000;"&gt; 60&amp;nbsp; &lt;/P&gt;&lt;P class="sasSource" style="color: #000000;"&gt; 61 %put &amp;amp;param ;&lt;/P&gt;&lt;P class="sasSource" style="color: #000000;"&gt; "x (a)"&lt;/P&gt;&lt;P class="sasSource" style="color: #000000;"&gt; 62 %put &amp;amp;param_clean ;&lt;/P&gt;&lt;P class="sasSource" style="color: #000000;"&gt; x&lt;/P&gt;&lt;P class="sasSource" style="color: #000000;"&gt; 63&amp;nbsp; &lt;/P&gt;&lt;P class="sasSource" style="color: #000000;"&gt; 64 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/P&gt;&lt;P class="sasSource" style="color: #000000;"&gt; 76&amp;nbsp; &lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2015 13:43:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-quoting-functions/m-p/206885#M38467</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-06-16T13:43:37Z</dc:date>
    </item>
  </channel>
</rss>

