<?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: Issue Creating a Table based on Macro's Parameter Name in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Issue-Creating-a-Table-based-on-Macro-s-Parameter-Name/m-p/411373#M100567</link>
    <description>&lt;P&gt;That is incredibly hard to follow. It looks like things got cut off at places?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Make sure to paste code using the insert code button in the Rich Text editor place.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Did you check that your macro variables are being created and resolved properly? Given what you've posted that's not clear.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's the { i } icon or the notebook icon.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have you looked into CALL EXECUTE as well? that may simplify your process.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When debugging macros use the following options so you can see the full log.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options mlogic mprint symbolgen;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 07 Nov 2017 21:03:43 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-11-07T21:03:43Z</dc:date>
    <item>
      <title>Issue Creating a Table based on Macro's Parameter Name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issue-Creating-a-Table-based-on-Macro-s-Parameter-Name/m-p/411369#M100563</link>
      <description>&lt;P&gt;So I will briefly explain my code structure before I dive into the issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. I've a macro&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;STRONG&gt; &amp;nbsp;%Sales &lt;/STRONG&gt;(Outdata= , dt =, Outdata2= , Outdata3= );&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; (&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; I create a table &lt;STRONG&gt;&amp;amp;outdata&lt;/STRONG&gt; by (Select * from XYZ);&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Proc SQL;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Create table &lt;FONT color="#FF0000"&gt;&amp;amp;Outdata._1&lt;/FONT&gt; as&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%mend Sales&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. Now I call the macro&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;%Sales (Outdata = &lt;FONT color="#FF0000"&gt;sales_final_Oct17&lt;/FONT&gt;, dt='2017-10-01');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Libname ABCDEFG&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;3. I Create a data set&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Data ABCDEFG.all_sales_test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Set&amp;nbsp; ABCDEFG. all_Sales&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;FONT color="#FF0000"&gt;&amp;nbsp; &amp;nbsp; sales_final_Oct17_1;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;incur_month = month(rept_dt);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;EM&gt;&lt;STRONG&gt;Above (1 to 3) is the original code flow and it works fine.&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#993366"&gt;&lt;U&gt;&lt;EM&gt;&lt;STRONG&gt;My Problem:&lt;/STRONG&gt;&lt;/EM&gt;&lt;/U&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using a dynamic way of generating file name for each month (so that each month I do not manually enter file_name_month and date.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;4. File name code&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;%let Last_Month = intnx('month', current_date,-1, "beginning");&lt;/P&gt;&lt;P&gt;Name = 'Sales_final';&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;Last_Month_Name&lt;/FONT&gt; = name|| put(&amp;amp;last_month, monyy7.);&lt;/P&gt;&lt;P&gt;Call SYMPUTX('Last_Month_Name_v',&lt;FONT color="#FF0000"&gt; Last_Month_Name&lt;/FONT&gt;);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Call Macro&lt;/P&gt;&lt;P&gt;%Sales(outdata=&lt;FONT color="#FF0000"&gt;&amp;amp;Last_Month_Name&lt;/FONT&gt;, dt = 'Dynamic date');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Till this point everything works fine. The moment I create a data set similar to step 3 (above), the code breaks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Libname ABCDEFG&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Data ABCDEFG.all_sales_test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;FONT color="#FF0000"&gt;Set&amp;nbsp; &lt;/FONT&gt;ABCDEFG. all_Sales&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#FF0000"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;Last_Month_Name&lt;/SPAN&gt;_1;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;incur_month = month(rept_dt);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;Error Message: File ABCDEFG.LAST_MONTH_NAME_1.DATA does not exist.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What should I do to get rid of this error? It seems, if I pass a static name in the macro and then use the same name with "_1" it works fine but when I pass dynamic reference, then the data Set step fails with the above error message.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is much appreciated. I'm new to SAS so excuse me if it's a silly question. Thanks.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2017 20:50:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issue-Creating-a-Table-based-on-Macro-s-Parameter-Name/m-p/411369#M100563</guid>
      <dc:creator>SteelersPitts</dc:creator>
      <dc:date>2017-11-07T20:50:03Z</dc:date>
    </item>
    <item>
      <title>Re: Issue Creating a Table based on Macro's Parameter Name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issue-Creating-a-Table-based-on-Macro-s-Parameter-Name/m-p/411372#M100566</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Data ABCDEFG.all_sales_test;
&amp;nbsp; &amp;nbsp; &amp;nbsp;Set&amp;nbsp;&amp;nbsp;ABCDEFG. all_Sales
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Last_Month_Name_1;
&amp;nbsp; &amp;nbsp; &amp;nbsp;incur_month = month(rept_dt);
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think you want&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&amp;amp;last_month_name._1;&lt;/PRE&gt;
&lt;P&gt;which will use the macro variable you created.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2017 20:57:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issue-Creating-a-Table-based-on-Macro-s-Parameter-Name/m-p/411372#M100566</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2017-11-07T20:57:40Z</dc:date>
    </item>
    <item>
      <title>Re: Issue Creating a Table based on Macro's Parameter Name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issue-Creating-a-Table-based-on-Macro-s-Parameter-Name/m-p/411373#M100567</link>
      <description>&lt;P&gt;That is incredibly hard to follow. It looks like things got cut off at places?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Make sure to paste code using the insert code button in the Rich Text editor place.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Did you check that your macro variables are being created and resolved properly? Given what you've posted that's not clear.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's the { i } icon or the notebook icon.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have you looked into CALL EXECUTE as well? that may simplify your process.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When debugging macros use the following options so you can see the full log.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options mlogic mprint symbolgen;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2017 21:03:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issue-Creating-a-Table-based-on-Macro-s-Parameter-Name/m-p/411373#M100567</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-11-07T21:03:43Z</dc:date>
    </item>
    <item>
      <title>Re: Issue Creating a Table based on Macro's Parameter Name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issue-Creating-a-Table-based-on-Macro-s-Parameter-Name/m-p/411408#M100577</link>
      <description>&lt;P&gt;I apologize Reeza. I will do a better job in formatting my code next time. According to my organization privacy rules, I can not publish the code here. I tried PaigeMiller's recommendation and it worked.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Nov 2017 02:20:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issue-Creating-a-Table-based-on-Macro-s-Parameter-Name/m-p/411408#M100577</guid>
      <dc:creator>SteelersPitts</dc:creator>
      <dc:date>2017-11-08T02:20:42Z</dc:date>
    </item>
    <item>
      <title>Re: Issue Creating a Table based on Macro's Parameter Name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issue-Creating-a-Table-based-on-Macro-s-Parameter-Name/m-p/411409#M100578</link>
      <description>&lt;P&gt;Thanks a lot Paige!&lt;/P&gt;</description>
      <pubDate>Wed, 08 Nov 2017 02:21:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issue-Creating-a-Table-based-on-Macro-s-Parameter-Name/m-p/411409#M100578</guid>
      <dc:creator>SteelersPitts</dc:creator>
      <dc:date>2017-11-08T02:21:07Z</dc:date>
    </item>
  </channel>
</rss>

