<?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 doesn't work with dataset option in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-doesn-t-work-with-dataset-option/m-p/726210#M225652</link>
    <description>&lt;P&gt;Hello everyone,&lt;/P&gt;
&lt;P&gt;I have created a list by %let variables= var1 var2 var3 var4 var5 var6;&lt;/P&gt;
&lt;P&gt;would like to use it as below&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _output;&lt;/P&gt;
&lt;P&gt;set input(keep=(&amp;amp;variables.));&amp;nbsp; &amp;nbsp;/*var1--var6 should be taken from here*/&lt;/P&gt;
&lt;P&gt;run;&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This throws an error but if I do as below, it comes correct.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _output;&lt;/P&gt;
&lt;P&gt;set input;&lt;/P&gt;
&lt;P&gt;keep &amp;amp;variables.;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;anyone, who has overcame this , please help me know why we can't do like the first step?&lt;/P&gt;</description>
    <pubDate>Mon, 15 Mar 2021 07:44:12 GMT</pubDate>
    <dc:creator>sahoositaram555</dc:creator>
    <dc:date>2021-03-15T07:44:12Z</dc:date>
    <item>
      <title>Macro doesn't work with dataset option</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-doesn-t-work-with-dataset-option/m-p/726210#M225652</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;
&lt;P&gt;I have created a list by %let variables= var1 var2 var3 var4 var5 var6;&lt;/P&gt;
&lt;P&gt;would like to use it as below&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _output;&lt;/P&gt;
&lt;P&gt;set input(keep=(&amp;amp;variables.));&amp;nbsp; &amp;nbsp;/*var1--var6 should be taken from here*/&lt;/P&gt;
&lt;P&gt;run;&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This throws an error but if I do as below, it comes correct.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _output;&lt;/P&gt;
&lt;P&gt;set input;&lt;/P&gt;
&lt;P&gt;keep &amp;amp;variables.;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;anyone, who has overcame this , please help me know why we can't do like the first step?&lt;/P&gt;</description>
      <pubDate>Mon, 15 Mar 2021 07:44:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-doesn-t-work-with-dataset-option/m-p/726210#M225652</guid>
      <dc:creator>sahoositaram555</dc:creator>
      <dc:date>2021-03-15T07:44:12Z</dc:date>
    </item>
    <item>
      <title>Re: Macro doesn't work with dataset option</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-doesn-t-work-with-dataset-option/m-p/726211#M225653</link>
      <description>&lt;P&gt;Simply loose the inner (). This works&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data input;
   array var{10} (1 : 10);
run;

%let variables= var1 var2 var3 var4 var5 var6;

data output;
   set input(keep=&amp;amp;variables.); 
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Mar 2021 07:49:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-doesn-t-work-with-dataset-option/m-p/726211#M225653</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-03-15T07:49:21Z</dc:date>
    </item>
    <item>
      <title>Re: Macro doesn't work with dataset option</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-doesn-t-work-with-dataset-option/m-p/726216#M225657</link>
      <description>&lt;P&gt;Always test your macro-free code before adding the macro layer. Always.&lt;/P&gt;
&lt;P&gt;Here the code is invalid.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Mar 2021 08:18:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-doesn-t-work-with-dataset-option/m-p/726216#M225657</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-03-15T08:18:42Z</dc:date>
    </item>
    <item>
      <title>Re: Macro doesn't work with dataset option</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-doesn-t-work-with-dataset-option/m-p/726233#M225665</link>
      <description>&lt;P&gt;A macro is just a code generator.&lt;/P&gt;
&lt;P&gt;Compare next two codes - the 1st with parenthesis, the 2nd without:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* 1 */
data output;
  set input (keep=(var1 var2 var3));
run;

/* 2 */
data output;
  set input(keep=var1 var2 var3);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The first code is invalid.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Mar 2021 10:59:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-doesn-t-work-with-dataset-option/m-p/726233#M225665</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2021-03-15T10:59:04Z</dc:date>
    </item>
  </channel>
</rss>

