<?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: how do i resolve macro variable inside names in external file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-do-i-resolve-macro-variable-inside-names-in-external-file/m-p/477010#M122786</link>
    <description>&lt;P&gt;Hey KurtBremser,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;that works. Thank you very much for your reply!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 11 Jul 2018 09:08:10 GMT</pubDate>
    <dc:creator>Tegg</dc:creator>
    <dc:date>2018-07-11T09:08:10Z</dc:date>
    <item>
      <title>how do i resolve macro variable inside names in external file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-i-resolve-macro-variable-inside-names-in-external-file/m-p/477002#M122780</link>
      <description>&lt;P&gt;Hello everybody,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a external file as a txt. file. Inside the file there is a proc SQL Statement.&lt;/P&gt;&lt;P&gt;My Textfile looks like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc SQL;

select * from afdeb.dbdb01eg;&lt;BR /&gt;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I want to replace the 01 inside the table name as&amp;nbsp;a macro variable like &lt;FONT face="arial,helvetica,sans-serif"&gt;afdeb.dbdb&amp;amp;_xx.eg. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;I know if I want to replace macro variables in external files I have to work with double quotes like afdeb.dbdb"&amp;amp;_xx."eg. But it only works outside a name. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;For your understanding: I have tables with generations. 01 is the current month, 02 the month before and so on. My plan is to increment the generations&amp;nbsp;to get all data. The&amp;nbsp;SQL Statement lays on a Server&amp;nbsp;in a text file. &amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Is it possible to resolve a macro variable in a external file inside a name? &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Many thanks for your help!&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial black,avant garde"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jul 2018 08:19:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-i-resolve-macro-variable-inside-names-in-external-file/m-p/477002#M122780</guid>
      <dc:creator>Tegg</dc:creator>
      <dc:date>2018-07-11T08:19:13Z</dc:date>
    </item>
    <item>
      <title>Re: how do i resolve macro variable inside names in external file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-i-resolve-macro-variable-inside-names-in-external-file/m-p/477004#M122781</link>
      <description>&lt;P&gt;If you define a macro variable first, you can use it in an include:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* first, let's create the textfile with SAS code */

filename external temp;

data _null_;
file external;
input textline $80.;
put textline;
datalines4;
proc SQL;
create table test as select * from sashelp.c&amp;amp;mac.s;
quit;
;;;;
run;

/* now call it, and set the macro variable before */

%let mac=las;
options source2; /* let's see the code we get */
%include external;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In your case, replace the temporary file reference with your actual filename, and since you already have it, the data _null_ step is of course not necessary. It's just there to create an external file for testing from code.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jul 2018 08:29:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-i-resolve-macro-variable-inside-names-in-external-file/m-p/477004#M122781</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-07-11T08:29:39Z</dc:date>
    </item>
    <item>
      <title>Re: how do i resolve macro variable inside names in external file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-i-resolve-macro-variable-inside-names-in-external-file/m-p/477010#M122786</link>
      <description>&lt;P&gt;Hey KurtBremser,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;that works. Thank you very much for your reply!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jul 2018 09:08:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-i-resolve-macro-variable-inside-names-in-external-file/m-p/477010#M122786</guid>
      <dc:creator>Tegg</dc:creator>
      <dc:date>2018-07-11T09:08:10Z</dc:date>
    </item>
    <item>
      <title>Re: how do i resolve macro variable inside names in external file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-i-resolve-macro-variable-inside-names-in-external-file/m-p/477015#M122789</link>
      <description>&lt;P&gt;Hey KurtBremser,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have another questions regarding the testfiles in sas.&lt;/P&gt;&lt;P&gt;I want to create two tables. If the table name contains 01 I want to create the first tabe, if 02 another.&lt;/P&gt;&lt;P&gt;Is it possible to put the if-condition into the Textfile or do i have to do it in a separate macro?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards!&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jul 2018 09:48:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-i-resolve-macro-variable-inside-names-in-external-file/m-p/477015#M122789</guid>
      <dc:creator>Tegg</dc:creator>
      <dc:date>2018-07-11T09:48:05Z</dc:date>
    </item>
  </channel>
</rss>

