<?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: SAS macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-macro/m-p/506751#M135838</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try changing your %if condition to:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%if T1 = &amp;amp;dsn %then %do;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Amir.&lt;/P&gt;</description>
    <pubDate>Tue, 23 Oct 2018 08:36:34 GMT</pubDate>
    <dc:creator>Amir</dc:creator>
    <dc:date>2018-10-23T08:36:34Z</dc:date>
    <item>
      <title>SAS macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-macro/m-p/506747#M135835</link>
      <description>&lt;P&gt;May I know what wrong with the macro below as I can't get the T1 dataset? Thanks.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%LET PERIODE=01sep2018;&lt;BR /&gt;%LET TODATE ="10sep2018"D;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;DATA _NULL_;&lt;BR /&gt;IF INTCK('DAY',"&amp;amp;PERIODE"D,&amp;amp;TODATE.) ge 8&lt;BR /&gt;THEN call symputx("T", "T1");&lt;BR /&gt;ELSE call symputx("T", "T2");&lt;BR /&gt;RUN;&lt;BR /&gt;%PUT T=&amp;amp;T;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro check(dsn);&lt;BR /&gt;%if T = "&amp;amp;dsn" %then %do;&lt;BR /&gt;DATA T1;&lt;BR /&gt;SET SASHELP.CARS;&lt;BR /&gt;IF MAKE EQ 'BMW';&lt;BR /&gt;RUN;&lt;BR /&gt;%end;&lt;BR /&gt;%else %do;&lt;BR /&gt;DATA T2;&lt;BR /&gt;SET SASHELP.CARS;&lt;BR /&gt;RUN;&lt;BR /&gt;%end;&lt;BR /&gt;%mend check;&lt;BR /&gt;%check(T1);&lt;/P&gt;</description>
      <pubDate>Tue, 23 Oct 2018 08:04:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-macro/m-p/506747#M135835</guid>
      <dc:creator>scb</dc:creator>
      <dc:date>2018-10-23T08:04:09Z</dc:date>
    </item>
    <item>
      <title>Re: SAS macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-macro/m-p/506749#M135837</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if T = "&amp;amp;dsn" %then %do;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In this macro statement, you compare the string&lt;/P&gt;
&lt;PRE&gt;T&lt;/PRE&gt;
&lt;P&gt;with a string that (as the macro is called later) is&lt;/P&gt;
&lt;PRE&gt;"T1"&lt;/PRE&gt;
&lt;P&gt;note the presence and absence of quotes.&lt;/P&gt;
&lt;P&gt;What you probably wanted:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if &amp;amp;T = &amp;amp;dsn %then %do;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The macro preprocessor does not need quotes when comparing strings, as everything is a string for it.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Oct 2018 08:32:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-macro/m-p/506749#M135837</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-10-23T08:32:28Z</dc:date>
    </item>
    <item>
      <title>Re: SAS macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-macro/m-p/506751#M135838</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try changing your %if condition to:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%if T1 = &amp;amp;dsn %then %do;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Amir.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Oct 2018 08:36:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-macro/m-p/506751#M135838</guid>
      <dc:creator>Amir</dc:creator>
      <dc:date>2018-10-23T08:36:34Z</dc:date>
    </item>
    <item>
      <title>Re: SAS macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-macro/m-p/506752#M135839</link>
      <description>&lt;P&gt;"&lt;SPAN&gt;May I know what wrong with the macro below&amp;nbsp;" - its all in upper case, no use of the code window {i}, so code is next to impossible to read, no log provided to explain what is "wrong".&amp;nbsp; (all mentioned previously).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;At a guess I would say:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;%if  T&lt;/PRE&gt;
&lt;P&gt;is your problem as macro variables need an &amp;amp; before, and should also for good coding have a . afterwards.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Oct 2018 08:58:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-macro/m-p/506752#M135839</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-10-23T08:58:08Z</dc:date>
    </item>
  </channel>
</rss>

