<?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: Question about using %include in a macro to include another macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Question-about-using-include-in-a-macro-to-include-another-macro/m-p/186215#M265646</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In that case it is the missing semi-colon that is making the data step not run.&lt;/P&gt;&lt;P&gt;Did it also complain that it could not find the files named DATE and FINAL_OUTPUT ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 18 Jul 2014 21:35:28 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2014-07-18T21:35:28Z</dc:date>
    <item>
      <title>Question about using %include in a macro to include another macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-using-include-in-a-macro-to-include-another-macro/m-p/186214#M265645</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Very often when I use %include within a macro, to invoke another macro or a set of macros, when I execute the main macro stops running at the %include.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, for instance.&amp;nbsp; If my macro looked like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro Test();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Data Output; set input;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Var="TEST";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %include "C:\user\Sub_Macros"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Data Final_output; set Sub_Macros_Input;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Var2="Finished";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The data step for "Final_output" won't run.&amp;nbsp; The macro just ends at the %include....&amp;nbsp; it's really annoying.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2014 21:31:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-using-include-in-a-macro-to-include-another-macro/m-p/186214#M265645</guid>
      <dc:creator>Doxastic</dc:creator>
      <dc:date>2014-07-18T21:31:43Z</dc:date>
    </item>
    <item>
      <title>Re: Question about using %include in a macro to include another macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-using-include-in-a-macro-to-include-another-macro/m-p/186215#M265646</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In that case it is the missing semi-colon that is making the data step not run.&lt;/P&gt;&lt;P&gt;Did it also complain that it could not find the files named DATE and FINAL_OUTPUT ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2014 21:35:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-using-include-in-a-macro-to-include-another-macro/m-p/186215#M265646</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-07-18T21:35:28Z</dc:date>
    </item>
    <item>
      <title>Re: Question about using %include in a macro to include another macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-using-include-in-a-macro-to-include-another-macro/m-p/186216#M265647</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is no need to define a macro inside the definition of another macro.&amp;nbsp; You are just asking the computer to do extra work since now it has to re-define the macro every time you run the outer macro.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%macro Test();&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Data Output; set input;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Var="TEST";&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * Call SUB_MACRO ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %SUB_MACRO;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Data Final_output; set Sub_Macros_Input;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Var2="Finished";&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%mend;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; background-color: #ffffff;"&gt;* Include definition of SUB_MACRO ;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; background-color: #ffffff;"&gt;%include "C:\user\Sub_Macros";&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;*&amp;nbsp; Call main macro;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2014 21:38:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-using-include-in-a-macro-to-include-another-macro/m-p/186216#M265647</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-07-18T21:38:02Z</dc:date>
    </item>
    <item>
      <title>Re: Question about using %include in a macro to include another macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-using-include-in-a-macro-to-include-another-macro/m-p/186217#M265648</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Adding the semicolon doesn't help....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It just stop executing after the %include.&amp;nbsp; There's no errors, it just stops.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2014 21:38:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-using-include-in-a-macro-to-include-another-macro/m-p/186217#M265648</guid>
      <dc:creator>Doxastic</dc:creator>
      <dc:date>2014-07-18T21:38:17Z</dc:date>
    </item>
    <item>
      <title>Re: Question about using %include in a macro to include another macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-using-include-in-a-macro-to-include-another-macro/m-p/186218#M265649</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Unbalanced quotes?&lt;/P&gt;&lt;P&gt;Or worse the include file includes and ENDSAS statement?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2014 21:41:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-using-include-in-a-macro-to-include-another-macro/m-p/186218#M265649</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-07-18T21:41:28Z</dc:date>
    </item>
    <item>
      <title>Re: Question about using %include in a macro to include another macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-using-include-in-a-macro-to-include-another-macro/m-p/186219#M265650</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Does the %include run on its own? Without being inside a macro?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2014 21:42:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-using-include-in-a-macro-to-include-another-macro/m-p/186219#M265650</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-07-18T21:42:57Z</dc:date>
    </item>
    <item>
      <title>Re: Question about using %include in a macro to include another macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-using-include-in-a-macro-to-include-another-macro/m-p/186220#M265651</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I do place macros within macros all the time.&amp;nbsp; I don't like 2000 lines in a macro.... It's just confusing.&amp;nbsp; And there will often be pieces of a macro that themselves can be macro-tized for use in a different macro or just code in general.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I use SAS to write ETLs on flat files.&amp;nbsp; So I have really long SAS programs.&amp;nbsp; Putting everything in one macro would make some macros confusingly long....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On top of that, they won't be dynamic anymore.&amp;nbsp; Here's how I'm using %include (this time):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro Import(FilePath);&lt;/P&gt;&lt;P&gt;%get_filenames(&amp;amp;FilePath.);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data rename_var(keep= Campaign_Names); set campaign_file_names;&amp;nbsp; Campaign_Names=VAR1; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data Camp_Total; set rename_var; count+1; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data Camp_Macro_Names(keep=Var); set Camp_Total;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Var=cat('%let campy',count,'=',Campaign_Names,';');&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set Camp_Macro_Names;&lt;/P&gt;&lt;P&gt;&amp;nbsp; FILE "E:\Shared\Progressive\Campaigns\Specify Campaigns_&amp;amp;today..txt" DLM=',';&lt;/P&gt;&lt;P&gt;&amp;nbsp; PUT Var;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%include "E:\Shared\Progressive\Campaigns\Specify Campaigns_&amp;amp;today..txt";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc import datafile="&amp;amp;FilePath.\&amp;amp;&amp;amp;campy&amp;amp;i...csv" &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; out=tempy&amp;amp;i&lt;/P&gt;&lt;P&gt;&amp;nbsp; dbms=dlm replace;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; delimiter=',';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; getnames = no;&lt;/P&gt;&lt;P&gt;&amp;nbsp; datarow=1;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create table camp&amp;amp;i as&lt;/P&gt;&lt;P&gt;&amp;nbsp; select a.* from tempy&amp;amp;i a &lt;/P&gt;&lt;P&gt;&amp;nbsp; where var1 ne .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; order by var2;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc datasets; delete tempy&amp;amp;i; run; quit;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data campaigns_rerun(keep= HH_id&amp;nbsp; airing_date live_offset Network daypart); set &lt;/P&gt;&lt;P&gt; %read2&lt;/P&gt;&lt;P&gt; ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rename var6 = HH_id;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rename var4 = airing_date;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rename var7 = live_offset;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; rename var16 = Network;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; rename var20 = daypart;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;%mend Import;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Everything after the %include won't run.&amp;nbsp; SAS stops executing after the %include and it doesn't error out.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2014 21:46:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-using-include-in-a-macro-to-include-another-macro/m-p/186220#M265651</guid>
      <dc:creator>Doxastic</dc:creator>
      <dc:date>2014-07-18T21:46:54Z</dc:date>
    </item>
    <item>
      <title>Re: Question about using %include in a macro to include another macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-using-include-in-a-macro-to-include-another-macro/m-p/186221#M265652</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have no idea if %include has ENDSAS built into it.... nor do I know how to figure that out.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2014 21:49:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-using-include-in-a-macro-to-include-another-macro/m-p/186221#M265652</guid>
      <dc:creator>Doxastic</dc:creator>
      <dc:date>2014-07-18T21:49:17Z</dc:date>
    </item>
    <item>
      <title>Re: Question about using %include in a macro to include another macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-using-include-in-a-macro-to-include-another-macro/m-p/186222#M265653</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes.&amp;nbsp; %include runs on its own.&amp;nbsp; It also runs inside the macro.&amp;nbsp; SAS stops executing AFTER the %include.&amp;nbsp; So it runs that piece, it just stops after.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2014 21:50:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-using-include-in-a-macro-to-include-another-macro/m-p/186222#M265653</guid>
      <dc:creator>Doxastic</dc:creator>
      <dc:date>2014-07-18T21:50:06Z</dc:date>
    </item>
    <item>
      <title>Re: Question about using %include in a macro to include another macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-using-include-in-a-macro-to-include-another-macro/m-p/186223#M265654</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sounds like a data issue.&amp;nbsp; You are using the values of a data step variable to write %LET statements. Most likely the content of the file contains something that should be macro quoted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that you are not including any macro definitions here.&amp;nbsp; You are including some lines of code with %LET statements to define some macro variables.&lt;/P&gt;&lt;P&gt;And not even lines of code from some other code file, but lines of code generated from data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Note that you can replace the four data steps and the %INCLUDE with a single data _NULL_ that uses CALL SYMPUTX to create the macro variables.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;_null_&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; campaign_file_names;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;call&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; symputx(cats(&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;'campy'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;,_n_),var1);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;There are more issues after that also as you seem to want to loop of these macro variables since you later reference &amp;amp;&amp;amp;CAMPY&amp;amp;I but there is no macro logic to do the looping.&lt;/P&gt;&lt;P&gt;Also you are calling a macro in the middle of a SET statement.&amp;nbsp; Perhaps you meant to reference a macro variable instead at that point?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2014 21:59:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-using-include-in-a-macro-to-include-another-macro/m-p/186223#M265654</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-07-18T21:59:00Z</dc:date>
    </item>
    <item>
      <title>Re: Question about using %include in a macro to include another macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-using-include-in-a-macro-to-include-another-macro/m-p/186224#M265655</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'll try that again... but that's what I first tried and I couldn't get it working.&amp;nbsp; I'll get back in a bit to let you know if it works.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2014 22:03:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-using-include-in-a-macro-to-include-another-macro/m-p/186224#M265655</guid>
      <dc:creator>Doxastic</dc:creator>
      <dc:date>2014-07-18T22:03:47Z</dc:date>
    </item>
    <item>
      <title>Re: Question about using %include in a macro to include another macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-using-include-in-a-macro-to-include-another-macro/m-p/186225#M265656</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Looks like you just want to read all of the CSV files in a folder. You seem to be assuming they all have the same format, so why not just write the data step to read them instead of letting PROC IMPORT guess what is in the file?&lt;/P&gt;&lt;P&gt;From looking at your program it looks like something like this should work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; Import(FilePath);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; campaigns_rerun ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; filename fname $&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;256&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;infile&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;"&amp;amp;FilePath\*.csv"&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;dsd&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;filename&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;=fname &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;truncover&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; skip1 @;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; skip1=&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;.&lt;/STRONG&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;delete&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; filename = fname ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; skip2-skip19 $&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;200&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; airing_date &lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;8&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; HH_id $&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;10&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; live_offset $&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;10&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Network $&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;20&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; daypart $&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;10&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;informat&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; airing_date &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: teal; background: white;"&gt;anydtdte.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;format&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; airing_date &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: teal; background: white;"&gt;date9.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; skip2 skip3 airing_date skip5 HH_id live_offset&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; skip8-skip15 Netowrk skip17-skip19 daypart&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;drop&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; skip: ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; Import;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2014 23:07:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-using-include-in-a-macro-to-include-another-macro/m-p/186225#M265656</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-07-18T23:07:33Z</dc:date>
    </item>
    <item>
      <title>Re: Question about using %include in a macro to include another macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-using-include-in-a-macro-to-include-another-macro/m-p/186226#M265657</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you all for your help, btw!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@Tom:&amp;nbsp; I didn't think to do it how you are doing it.&amp;nbsp; And honestly, I don't really understand it.&amp;nbsp; If I can get it working this way, I'd like to keep it just because I get it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And I don't think the problem is with the %include anymore....&amp;nbsp; I have no idea.&amp;nbsp; I thought it was the %include because it's happened before.&amp;nbsp; But when I got your symput code working, and macro-tized it, it failed again.&amp;nbsp; Here's the code as it is now:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro Import_Campaigns(FilePath, ncampaigns, Data_type);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%get_filenames(&amp;amp;FilePath.); /* Gets file names from a directory and puts them into a SAS dataset */&lt;/P&gt;&lt;P&gt;%Create_Mac_Var(campy, memname);&amp;nbsp; /*&amp;nbsp; Tom's symput code in macro form ("campy" and "Var1" are macro variables)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*******************&amp;nbsp;&amp;nbsp; This is where thing seem to be going wrong.&amp;nbsp; Either in the step above or the step below.... idk&amp;nbsp; */&lt;/P&gt;&lt;P&gt;%if &amp;amp;Data_type.="csv" %then %do i=1 %to &amp;amp;ncampaigns.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc import datafile="&amp;amp;FilePath.\&amp;amp;&amp;amp;campy&amp;amp;i.."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; out=tempy&amp;amp;i&lt;/P&gt;&lt;P&gt;&amp;nbsp; dbms=dlm replace;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; delimiter=',';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; getnames = no;&lt;/P&gt;&lt;P&gt;&amp;nbsp; datarow=1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create table campy&amp;amp;i as&lt;/P&gt;&lt;P&gt;&amp;nbsp; select a.* from tempy&amp;amp;i a&lt;/P&gt;&lt;P&gt;&amp;nbsp; where var1 ne .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; order by var2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc datasets; delete tempy&amp;amp;i; run; quit;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%if &amp;amp;Data_type.="pipe" %then %do i=&amp;amp;start. %to &amp;amp;stop.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc import datafile="&amp;amp;FilePath.\&amp;amp;&amp;amp;camp&amp;amp;i...txt"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; out=tempy&amp;amp;i&lt;/P&gt;&lt;P&gt;&amp;nbsp; dbms=dlm replace;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; delimiter='|';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; getnames = no;&lt;/P&gt;&lt;P&gt;&amp;nbsp; datarow=4;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create table campy&amp;amp;i as&lt;/P&gt;&lt;P&gt;&amp;nbsp; select a.* from tempy&amp;amp;i a&lt;/P&gt;&lt;P&gt;&amp;nbsp; where var1 ne .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; order by var2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc datasets; delete tempy&amp;amp;i; run; quit;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%if &amp;amp;Data_type.="csv" %then %do;&lt;/P&gt;&lt;P&gt;data campaigns_rerun(keep= HH_id&amp;nbsp; airing_date live_offset Network daypart); set&lt;/P&gt;&lt;P&gt;%read2&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rename var6 = HH_id;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rename var4 = airing_date;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rename var7 = live_offset;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; rename var16 = Network;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; rename var20 = daypart;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%if &amp;amp;Data_type.="pipe" %then %do;&lt;/P&gt;&lt;P&gt;data campaigns_rerun(keep= HH_id&amp;nbsp; airing_date live_offset Network daypart); set&lt;/P&gt;&lt;P&gt;%read2&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rename var1 = HH_id;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rename var2 = airing_date;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rename var3 = live_offset;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; rename var4 = Network;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; rename var5 = daypart;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%mend Import_Campaigns;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And here's the log for that entire length of code.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;23588&amp;nbsp; %Import_Campaigns(E:\Shared\Campaigns\temp\csv, 5, csv);&lt;/P&gt;&lt;P&gt;SYMBOLGEN:&amp;nbsp; Macro variable FILEPATH resolves to E:\Shared\Campaigns\temp\csv&lt;/P&gt;&lt;P&gt;SYMBOLGEN:&amp;nbsp; Macro variable LOCATION resolves to E:\Shared\Campaigns\temp\csv&lt;/P&gt;&lt;P&gt;MPRINT(GET_FILENAMES):&amp;nbsp;&amp;nbsp; filename _dir_ "E:\Shared\Progressive\Campaigns\temp\csv";&lt;/P&gt;&lt;P&gt;MPRINT(GET_FILENAMES):&amp;nbsp;&amp;nbsp; data campaign_file_names(keep=memname);&lt;/P&gt;&lt;P&gt;MPRINT(GET_FILENAMES):&amp;nbsp;&amp;nbsp; handle=dopen( '_dir_' );&lt;/P&gt;&lt;P&gt;MPRINT(GET_FILENAMES):&amp;nbsp;&amp;nbsp; if handle &amp;gt; 0 then do;&lt;/P&gt;&lt;P&gt;MPRINT(GET_FILENAMES):&amp;nbsp;&amp;nbsp; count=dnum(handle);&lt;/P&gt;&lt;P&gt;MPRINT(GET_FILENAMES):&amp;nbsp;&amp;nbsp; do i=1 to count;&lt;/P&gt;&lt;P&gt;MPRINT(GET_FILENAMES):&amp;nbsp;&amp;nbsp; memname=dread(handle,i);&lt;/P&gt;&lt;P&gt;MPRINT(GET_FILENAMES):&amp;nbsp;&amp;nbsp; output campaign_file_names;&lt;/P&gt;&lt;P&gt;MPRINT(GET_FILENAMES):&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;MPRINT(GET_FILENAMES):&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;MPRINT(GET_FILENAMES):&amp;nbsp;&amp;nbsp; rc=dclose(handle);&lt;/P&gt;&lt;P&gt;MPRINT(GET_FILENAMES):&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: The data set WORK.CAMPAIGN_FILE_NAMES has 5 observations and 1 variables.&lt;/P&gt;&lt;P&gt;NOTE: Compressing data set WORK.CAMPAIGN_FILE_NAMES increased size by 100.00 percent.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Compressed is 2 pages; un-compressed would require 1 pages.&lt;/P&gt;&lt;P&gt;NOTE: DATA statement used (Total process time):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cpu time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00 seconds&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MPRINT(GET_FILENAMES):&amp;nbsp;&amp;nbsp; filename _dir_ clear;&lt;/P&gt;&lt;P&gt;NOTE: Fileref _DIR_ has been deassigned.&lt;/P&gt;&lt;P&gt;MPRINT(IMPORT_CAMPAIGNS):&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;MPRINT(IMPORT_CAMPAIGNS):&amp;nbsp;&amp;nbsp; data _null_ ;&lt;/P&gt;&lt;P&gt;MPRINT(IMPORT_CAMPAIGNS):&amp;nbsp;&amp;nbsp; set campaign_file_names;&lt;/P&gt;&lt;P&gt;MPRINT(IMPORT_CAMPAIGNS):&amp;nbsp;&amp;nbsp; call symputx(cats('campy',_n_),memname);&lt;/P&gt;&lt;P&gt;MPRINT(IMPORT_CAMPAIGNS):&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;NOTE: There were 5 observations read from the data set WORK.CAMPAIGN_FILE_NAMES.&lt;/P&gt;&lt;P&gt;NOTE: DATA statement used (Total process time):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cpu time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00 seconds&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SYMBOLGEN:&amp;nbsp; Macro variable DATA_TYPE resolves to csv&lt;/P&gt;&lt;P&gt;SYMBOLGEN:&amp;nbsp; Macro variable DATA_TYPE resolves to csv&lt;/P&gt;&lt;P&gt;SYMBOLGEN:&amp;nbsp; Macro variable DATA_TYPE resolves to csv&lt;/P&gt;&lt;P&gt;SYMBOLGEN:&amp;nbsp; Macro variable DATA_TYPE resolves to csv&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jul 2014 15:12:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-using-include-in-a-macro-to-include-another-macro/m-p/186226#M265657</guid>
      <dc:creator>Doxastic</dc:creator>
      <dc:date>2014-07-21T15:12:25Z</dc:date>
    </item>
    <item>
      <title>Re: Question about using %include in a macro to include another macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-using-include-in-a-macro-to-include-another-macro/m-p/186227#M265658</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Also, in the end this is what I'd like the macro to look like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro Import_Campaigns(FilePath, ncampaigns, Data_type);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%get_filenames(&amp;amp;FilePath.);&lt;/P&gt;&lt;P&gt;%Create_Mac_Var(campy, memname);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%if &amp;amp;Data_type.="csv" %then %do; %readcampaigns(1,&amp;amp;ncampaigns.,csv); %end;&amp;nbsp; /*&amp;nbsp; readcampaigns would be the last bit of the main macro, itself macro-tized.&amp;nbsp; */&lt;/P&gt;&lt;P&gt;%if &amp;amp;Data_type.="pipe" %then %do; %readcampaigns(1,&amp;amp;ncampaigns.,pipe); %end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%mend Import_Campaigns;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See how much easier this is to read and understand?&amp;nbsp; It also makes it so I can use all 3 of those macros in other places really easily.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is why I use macros within macros.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jul 2014 15:18:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-using-include-in-a-macro-to-include-another-macro/m-p/186227#M265658</guid>
      <dc:creator>Doxastic</dc:creator>
      <dc:date>2014-07-21T15:18:24Z</dc:date>
    </item>
    <item>
      <title>Re: Question about using %include in a macro to include another macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-using-include-in-a-macro-to-include-another-macro/m-p/186228#M265659</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would personally put your if statements in quotes and trim them e.g.:&lt;/P&gt;&lt;P&gt;%if %trim(&amp;amp;data_type)="csv".&amp;nbsp; Whats happening is the if statement is not true and hence none of the other code operates. &lt;/P&gt;&lt;P&gt;As Tom previously mentioned however, you don't need to do a lot of that code.&amp;nbsp; If you look at a datastep with an infile statement you can have multiple delimiters (there are examples on here of that).&amp;nbsp; The other code as well can also be trimmed.&amp;nbsp; Am leaving for the day, however if its still open I add some code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jul 2014 15:24:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-using-include-in-a-macro-to-include-another-macro/m-p/186228#M265659</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-07-21T15:24:39Z</dc:date>
    </item>
    <item>
      <title>Re: Question about using %include in a macro to include another macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-using-include-in-a-macro-to-include-another-macro/m-p/186229#M265660</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There's nothing wrong with this structure, but you need to make sure each component/module works on its own first and then the whole.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My other issue is you assume what the output files are named, which isn't a convention I like to use as it makes it harder to reuse components across different programs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, if you are trying to read all files from a folder, SAS has much more efficient ways of doing it than this as Tom has pointed out. Its really worth learning how to do it as your code will be cleaner and much easier to debug in the future. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jul 2014 15:30:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-using-include-in-a-macro-to-include-another-macro/m-p/186229#M265660</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-07-21T15:30:18Z</dc:date>
    </item>
    <item>
      <title>Re: Question about using %include in a macro to include another macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-using-include-in-a-macro-to-include-another-macro/m-p/186230#M265661</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This sounds interesting but I definitely don't understand how you'd do that&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jul 2014 15:44:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-using-include-in-a-macro-to-include-another-macro/m-p/186230#M265661</guid>
      <dc:creator>Doxastic</dc:creator>
      <dc:date>2014-07-21T15:44:36Z</dc:date>
    </item>
    <item>
      <title>Re: Question about using %include in a macro to include another macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-using-include-in-a-macro-to-include-another-macro/m-p/186231#M265662</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The path to hell is paved with good intentions. @doxastic the intention a good one as you have shown the wanted goal to achieve.&lt;BR /&gt; The coding habits to achieve that is not that good. Macro-codes should be easy to read pieces and all easy to debug ones.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;You can define a bunch of subset macros while using just one master macro. The trick is to define all those in the only source code named as "master" like:&lt;/P&gt;&lt;P&gt;source member (autocall or include) master:&lt;/P&gt;&lt;P&gt; /*&amp;nbsp; comment describing your macro */&lt;/P&gt;&lt;P&gt; %macro master&amp;nbsp; ..... ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; ...&lt;/P&gt;&lt;P&gt;&amp;nbsp; %mend;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; /*&amp;nbsp; comment used dedicated subroutines */ &lt;/P&gt;&lt;P&gt; %macro subblock1&amp;nbsp; ..... ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; ...&lt;/P&gt;&lt;P&gt;&amp;nbsp; %mend;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; %macro subblock2&amp;nbsp; ..... ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; ...&lt;/P&gt;&lt;P&gt;&amp;nbsp; %mend;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;And several will complain that doing it this way they cannot find all interactions of macro-s and code.&lt;/P&gt;&lt;P&gt;Working on this you can easily check and debug modifications. &lt;BR /&gt;One missed quoted ; or other nesting language element will cause your described troublesome behavior.&lt;/P&gt;&lt;P&gt;The macro language processor does the preprocessing somewhat different as the datastep/proc language. In rare situations having unexpected behavior.&lt;/P&gt;&lt;P&gt;Remember the macro references do not need the semicolon as that has a meaning at the other level. Macro quoting is an other area of language conflict solving.&lt;BR /&gt;The scope of macrovariables can be a pitfall, this is an automatic process with some conventions. &lt;/P&gt;&lt;P&gt;The generic&amp;nbsp; advice don not use defining macro-s within macro-s (some exceptions exist) however using macro-s within macro-s is allowed&amp;nbsp; practice.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jul 2014 15:45:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-using-include-in-a-macro-to-include-another-macro/m-p/186231#M265662</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2014-07-21T15:45:42Z</dc:date>
    </item>
    <item>
      <title>Re: Question about using %include in a macro to include another macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-using-include-in-a-macro-to-include-another-macro/m-p/186232#M265663</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So the issue is that the data in the list of files that you are importing contains characters that you would have to quote using macro quoting functions like %QUOTE, %BQUOTE etc if you typed them into you program file.&amp;nbsp; So when you used them to generate %LET statements they caused trouble. Now that you are using them to generate other SAS code you are seeing the problems in that code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In particular you are using&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 10pt; line-height: 1.5em;"&gt;datafile="&amp;amp;FilePath.\&amp;amp;&amp;amp;campy&amp;amp;i.." &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 10pt; line-height: 1.5em;"&gt;and &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&amp;nbsp; create table campy&amp;amp;i as&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;So if the name of the source file contains some strange characters you might have trouble with the DATAFILE= or if more likely with using the name as the name of SAS table.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;SAS tablenames can by up to 32 characters, digits and underscores and must not start with a digit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that your loops for CSV and PIPE are not consistent with each.&amp;nbsp; Since the only difference between the two is the value used for the DELIMITER in the PROC IMPORT you can simplify your logic. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%do&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; i=&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%to&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &amp;amp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: teal; background: white;"&gt;ncampaigns.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;import&lt;/STRONG&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;datafile&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;"&amp;amp;FilePath.\&amp;amp;&amp;amp;campy&amp;amp;i.."&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;out&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;=tempy&amp;amp;i&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;dbms&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;=dlm replace;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;getnames&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; = no;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;datarow&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;=&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%if&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &amp;amp;Data_type =&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;"csv"&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%then&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%do&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;delimiter&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;','&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%if&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &amp;amp;Data_type =&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;"pipe"&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%then&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%do&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;delimiter&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;'|'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;sql&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;create&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;table&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; campy&amp;amp;i &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;as&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;select&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: teal; background: white;"&gt;a.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;* &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; tempy&amp;amp;i a&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;where&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; var1 ne &lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;.&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;order&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; var2&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;drop&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;table&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; tempy&amp;amp;i ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;quit&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jul 2014 15:49:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-using-include-in-a-macro-to-include-another-macro/m-p/186232#M265663</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-07-21T15:49:43Z</dc:date>
    </item>
    <item>
      <title>Re: Question about using %include in a macro to include another macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-using-include-in-a-macro-to-include-another-macro/m-p/186233#M265664</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You use a wild card in your infile statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;infile 'C:\localdata\*.txt';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;points to all files in the folder C:\localdata that end with the extension .txt. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want the file name as well, the filename option can be added on to provide the filename. &lt;/P&gt;&lt;P&gt;If you're file has headers in each row, you'll want to ignore those.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try running Tom's code and see if it works. It's the correct solution to your problem. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jul 2014 15:50:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-using-include-in-a-macro-to-include-another-macro/m-p/186233#M265664</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-07-21T15:50:17Z</dc:date>
    </item>
  </channel>
</rss>

