<?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 Use string without resolving macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Use-string-without-resolving-macro/m-p/271636#M54036</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a conditional clause in my code which looks like below:-&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; if lowcase(compress(tt)) =: 'procprinttoprint="&amp;amp;protpath'
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now, I want to use this string as it is for comparison without resolving the macro variable "protpath" but its not letting me do so. Please help!&lt;/P&gt;</description>
    <pubDate>Thu, 19 May 2016 08:24:38 GMT</pubDate>
    <dc:creator>Aditi24</dc:creator>
    <dc:date>2016-05-19T08:24:38Z</dc:date>
    <item>
      <title>Use string without resolving macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Use-string-without-resolving-macro/m-p/271636#M54036</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a conditional clause in my code which looks like below:-&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; if lowcase(compress(tt)) =: 'procprinttoprint="&amp;amp;protpath'
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now, I want to use this string as it is for comparison without resolving the macro variable "protpath" but its not letting me do so. Please help!&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2016 08:24:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Use-string-without-resolving-macro/m-p/271636#M54036</guid>
      <dc:creator>Aditi24</dc:creator>
      <dc:date>2016-05-19T08:24:38Z</dc:date>
    </item>
    <item>
      <title>Re: Use string without resolving macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Use-string-without-resolving-macro/m-p/271638#M54037</link>
      <description>&lt;P&gt;If you enclose it in single quotes you should be fine.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your code includes one double quote but not the other? Is that a copy/paste error or the forum messing things up? Or what you want your code to look like.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; if lowcase(compress(tt)) =: 'procprinttoprint="&amp;amp;protpath'&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Please explain how it's not working, preferably with the log with the MPRINT option on.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2016 08:31:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Use-string-without-resolving-macro/m-p/271638#M54037</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-05-19T08:31:00Z</dc:date>
    </item>
    <item>
      <title>Re: Use string without resolving macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Use-string-without-resolving-macro/m-p/271641#M54038</link>
      <description>&lt;P&gt;I agree with&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza﻿&lt;/a&gt;, enclosing a macro variable in single quotes means that the macro pre-processor will not pick the &amp;amp; up as a macro reference and ignore it. &amp;nbsp;However, it does look like your processing code in another program, i.e. reading some SAS code in a processing it. &amp;nbsp;Not a very good way of doing things, have seen this approach several times and it is symptomatic of not following software development lifecycle processes. &amp;nbsp;I.e. you have code and are now trying to get documentation or validation from it. &amp;nbsp;This is not good for two reasons. &amp;nbsp;Firstly anything you do after the event cannot be construed as proper documentation or validation. &amp;nbsp;Secondly actually processing code is quite complicated. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2016 08:38:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Use-string-without-resolving-macro/m-p/271641#M54038</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-05-19T08:38:09Z</dc:date>
    </item>
    <item>
      <title>Re: Use string without resolving macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Use-string-without-resolving-macro/m-p/271642#M54039</link>
      <description>&lt;P&gt;Hi Reeza,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to match a particular line from the file having content like so&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc printto print = "&amp;amp;protpath/outlist/Programname.lst"
              log = "&amp;amp;protpath/outlog/Programname.log" new;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So, to match the first line exactly I am using&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; if lowcase(compress(tt)) =: 'procprinttoprint="&amp;amp;protpath'&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;since the rest of the&amp;nbsp;below string is not fixed and I want to use it as it is without any macro resolution. Also, I tried using %nrstr but&amp;nbsp;since its SCL code its not working in my data set.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;procprinttoprint="&amp;amp;protpath &lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2016 08:43:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Use-string-without-resolving-macro/m-p/271642#M54039</guid>
      <dc:creator>Aditi24</dc:creator>
      <dc:date>2016-05-19T08:43:27Z</dc:date>
    </item>
    <item>
      <title>Re: Use string without resolving macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Use-string-without-resolving-macro/m-p/271646#M54041</link>
      <description>&lt;P&gt;It works fine for me. You have some other issue besides the quotation marks or macro variable not resolving. Check your log and logic.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let protopath = Stupid;
data have;
length tt $100.;
tt='proc printto print = "&amp;amp;protpath/outlist/Programname.lst"
              log = "&amp;amp;protpath/outlog/Programname.log" new;';
if lowcase(compress(tt)) =: 'procprinttoprint="&amp;amp;protpath' then put "Pass";
else put "Fail";
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 May 2016 08:46:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Use-string-without-resolving-macro/m-p/271646#M54041</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-05-19T08:46:44Z</dc:date>
    </item>
    <item>
      <title>Re: Use string without resolving macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Use-string-without-resolving-macro/m-p/271647#M54042</link>
      <description>&lt;P&gt;Where's your problem?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
tt = 'proc printto print = "&amp;amp;protpath/outlist/Programname.lst"';
if lowcase(compress(tt)) =: 'procprinttoprint="&amp;amp;protpath'
then put 'yes';
else put 'no';
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;gives me this log:&lt;/P&gt;
&lt;PRE&gt;16         data _null_;
17         tt = 'proc printto print = "&amp;amp;protpath/outlist/Programname.lst"';
18         if lowcase(compress(tt)) =: 'procprinttoprint="&amp;amp;protpath'
19         then put 'yes';
20         else put 'no';
21         run;

yes
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
&lt;/PRE&gt;
&lt;P&gt;So the condition works.&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2016 08:48:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Use-string-without-resolving-macro/m-p/271647#M54042</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-05-19T08:48:10Z</dc:date>
    </item>
    <item>
      <title>Re: Use string without resolving macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Use-string-without-resolving-macro/m-p/271677#M54046</link>
      <description>&lt;P&gt;My code&amp;nbsp;is a mix of SCL and Base Programming because of which the macro variable "protpath" was getting resolved in the code.&lt;/P&gt;
&lt;P&gt;Using the below snippet&amp;nbsp;resolved the problem:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let match_string= %nrstr(procprinttoprint=%"&amp;amp;protpath/outlist/);&amp;nbsp;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks so much everyone for your input. This was urgently required.&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2016 11:13:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Use-string-without-resolving-macro/m-p/271677#M54046</guid>
      <dc:creator>Aditi24</dc:creator>
      <dc:date>2016-05-19T11:13:54Z</dc:date>
    </item>
  </channel>
</rss>

