<?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: Assigning SAS statements to macro variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Assigning-SAS-statements-to-macro-variable/m-p/428704#M105866</link>
    <description>The code is working thanks.</description>
    <pubDate>Thu, 18 Jan 2018 08:06:51 GMT</pubDate>
    <dc:creator>Sharathr</dc:creator>
    <dc:date>2018-01-18T08:06:51Z</dc:date>
    <item>
      <title>Assigning SAS statements to macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assigning-SAS-statements-to-macro-variable/m-p/428700#M105862</link>
      <description>Hi forum,&lt;BR /&gt;&lt;BR /&gt;Is it possible to assign SAS statements in macro variable refer example below.&lt;BR /&gt;%let condition= where a&amp;gt;5;&lt;BR /&gt;%macro test;&lt;BR /&gt;Data test;&lt;BR /&gt;Set source;&lt;BR /&gt;&amp;amp; Condition.;&lt;BR /&gt;Run;&lt;BR /&gt;%macro test;&lt;BR /&gt;%test;</description>
      <pubDate>Thu, 18 Jan 2018 07:57:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assigning-SAS-statements-to-macro-variable/m-p/428700#M105862</guid>
      <dc:creator>Sharathr</dc:creator>
      <dc:date>2018-01-18T07:57:43Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning SAS statements to macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assigning-SAS-statements-to-macro-variable/m-p/428703#M105865</link>
      <description>&lt;P&gt;You can answer your question by executing the code, reading the log and fixing errors that may be shown. If you need help fixing errors, post the log in code window see {i}-icon above the editing window.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2018 08:04:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assigning-SAS-statements-to-macro-variable/m-p/428703#M105865</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2018-01-18T08:04:10Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning SAS statements to macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assigning-SAS-statements-to-macro-variable/m-p/428704#M105866</link>
      <description>The code is working thanks.</description>
      <pubDate>Thu, 18 Jan 2018 08:06:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assigning-SAS-statements-to-macro-variable/m-p/428704#M105866</guid>
      <dc:creator>Sharathr</dc:creator>
      <dc:date>2018-01-18T08:06:51Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning SAS statements to macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assigning-SAS-statements-to-macro-variable/m-p/428712#M105867</link>
      <description>&lt;P&gt;As you noticed, you can do this.&amp;nbsp; However, notice a couple of features about your program.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The value of &amp;amp;CONDITION does not include a semicolon ending the WHERE statement.&amp;nbsp; The semicolon at the end of the %LET statement is needed to end the %LET statement.&amp;nbsp; So the value of &amp;amp;CONDITION is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where a&amp;gt;5&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The program that refers to &amp;amp;CONDITION uses:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;amp;condition;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That added semicolon following &amp;amp;CONDITION is what ends the WHERE statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you wanted to include a semicolon as part of the value of &amp;amp;CONDITION, that is possible using:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let condition = %str(where a&amp;gt;5; );&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The %STR function treats the first semicolon as text, not as a symbolic character that ends the %LET statement.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2018 08:34:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assigning-SAS-statements-to-macro-variable/m-p/428712#M105867</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-01-18T08:34:06Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning SAS statements to macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assigning-SAS-statements-to-macro-variable/m-p/428714#M105868</link>
      <description>Thanks</description>
      <pubDate>Thu, 18 Jan 2018 08:40:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assigning-SAS-statements-to-macro-variable/m-p/428714#M105868</guid>
      <dc:creator>Sharathr</dc:creator>
      <dc:date>2018-01-18T08:40:29Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning SAS statements to macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assigning-SAS-statements-to-macro-variable/m-p/428716#M105869</link>
      <description>&lt;P&gt;I would NOT do it that way; if I have to do something similar, I do this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let condition=a&amp;gt;5;

data test;
set source;
where &amp;amp;condition.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;That way it is clear &lt;EM&gt;which&lt;/EM&gt; statement is executed, and only the condition itself comes from the macro variable. This makes code much more read- and maintainable.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2018 08:44:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assigning-SAS-statements-to-macro-variable/m-p/428716#M105869</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-01-18T08:44:32Z</dc:date>
    </item>
  </channel>
</rss>

