<?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 Macro quoting functions in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-quoting-functions/m-p/218551#M40252</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have the following code and trying to extract first word (QTcF) how can i achieve this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data x;&lt;/P&gt;&lt;P&gt;input seq param $ 2-80;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;1 QTcB - Bazett's Correction Formula (msec)&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;data y;&lt;/P&gt;&lt;P&gt;set x;&lt;/P&gt;&lt;P&gt;call symput ("param", cats(param));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%put &amp;amp;param;&amp;nbsp; ( this is not resolved in log) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When i am doing the following way i get an error in the log&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let x = %scan("&amp;amp;param",1,-));&lt;/P&gt;&lt;P&gt;%put &amp;amp;x;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ERROR: Open code statement recursion detected.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 23 May 2015 20:47:11 GMT</pubDate>
    <dc:creator>SASSLICK001</dc:creator>
    <dc:date>2015-05-23T20:47:11Z</dc:date>
    <item>
      <title>Macro quoting functions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-quoting-functions/m-p/218551#M40252</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have the following code and trying to extract first word (QTcF) how can i achieve this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data x;&lt;/P&gt;&lt;P&gt;input seq param $ 2-80;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;1 QTcB - Bazett's Correction Formula (msec)&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;data y;&lt;/P&gt;&lt;P&gt;set x;&lt;/P&gt;&lt;P&gt;call symput ("param", cats(param));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%put &amp;amp;param;&amp;nbsp; ( this is not resolved in log) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When i am doing the following way i get an error in the log&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let x = %scan("&amp;amp;param",1,-));&lt;/P&gt;&lt;P&gt;%put &amp;amp;x;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ERROR: Open code statement recursion detected.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 May 2015 20:47:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-quoting-functions/m-p/218551#M40252</guid>
      <dc:creator>SASSLICK001</dc:creator>
      <dc:date>2015-05-23T20:47:11Z</dc:date>
    </item>
    <item>
      <title>Re: Macro quoting functions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-quoting-functions/m-p/218552#M40253</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First issue is that you are unable to create a macro variable where the value has a unbalanced quote. To avoid this you need to try the following code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data y;&lt;/P&gt;&lt;P&gt;set x;&lt;/P&gt;&lt;P&gt;call symputx('param', quote(trim(param)));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%put &amp;amp;param;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it will create the param macro variable with value. Then to get the QTCB please try&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let x = %substr(%qsysfunc(scan(&amp;amp;param,1,'-')),2);&lt;/P&gt;&lt;P&gt;%put &amp;amp;x; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First it will extract the QTCB and then it will remove the first quote by substr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please try and let me know if it was helpful.&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>Sun, 24 May 2015 02:40:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-quoting-functions/m-p/218552#M40253</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2015-05-24T02:40:53Z</dc:date>
    </item>
    <item>
      <title>Re: Macro quoting functions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-quoting-functions/m-p/218553#M40254</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually it's okay to have an unmatched quote inside a macro variable, as long as you macro quote it when you use it.&amp;nbsp; The following should work:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let x = %scan(%superq(param),1,-) ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Worked for me on free SAS University Edition running on AWS. So cool to have that.&amp;nbsp; Thank you SAS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--Q. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 24 May 2015 02:57:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-quoting-functions/m-p/218553#M40254</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2015-05-24T02:57:07Z</dc:date>
    </item>
  </channel>
</rss>

