<?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: Why my Macro code is not responding in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Why-my-Macro-code-is-not-responding/m-p/468989#M119869</link>
    <description>&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/143540"&gt;@nazmul&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You submitted the macro definition, but forgot to call the macro. That is, you told SAS to compile the macro, but not to execute the compiled code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Actually it was good that you omitted the macro call, because otherwise the log would be full of error messages:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;
&lt;P&gt;As a rule, macro variable references (such as &amp;amp;I) in single quotes are not resolved. So, you should enclose the path in double quotes in order to have the references &amp;amp;I replaced by your date values.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;Your %DO loop would iterate 12312017-3312011+1=9000007 times! Not only would it take a long time to execute nine million PROC IMPORT steps, but most of them would most likely result in error messages (even after the above correction) due to non-existing files, e.g. FFIEC CDR Call Bulk POR 3312019.txt. You should think about a way to loop through the relevant dates rather than through nine million integers (without leading zeros) which SAS does not recognize as dates.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Once you've corrected the macro (and have compiled it again), you may want to call it by simply submitting&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%POR&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 10 Jun 2018 10:03:10 GMT</pubDate>
    <dc:creator>FreelanceReinh</dc:creator>
    <dc:date>2018-06-10T10:03:10Z</dc:date>
    <item>
      <title>Why my Macro code is not responding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-my-Macro-code-is-not-responding/m-p/468985#M119865</link>
      <description>&lt;P&gt;Dear Everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using the following macro command but without any response from SAS. Could you please tell me why it is happening? I have bunch of text file in separate folders. I want to convert all of them in SAS format. I want to run macro to accomplish the step.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%MACRO POR;&lt;BR /&gt;%DO I = 03312011 %TO 12312017;&lt;BR /&gt;proc import datafile='H:\Seminar Class\Banking Seminar\Data by me\Bank Call Report\FFIEC data\FFIEC CDR Call Bulk All Schedules &amp;amp;I/FFIEC CDR Call Bulk POR &amp;amp;I.txt'&lt;BR /&gt;out=POR&amp;amp;I dbms=dlm replace;&lt;BR /&gt;datarow=2; delimiter='09'x;&lt;BR /&gt;run;&lt;BR /&gt;%END;&lt;BR /&gt;%MEND POR;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Log Output:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;1052 %MACRO POR;&lt;BR /&gt;1053 %DO I = 03312011 %TO 12312017;&lt;BR /&gt;1054 proc import datafile='H:\Seminar Class\Banking Seminar\Data by me\Bank Call Report\FFIEC&lt;BR /&gt;1054! data\FFIEC CDR Call Bulk All Schedules &amp;amp;I/FFIEC CDR Call Bulk POR &amp;amp;I.txt'&lt;BR /&gt;1055 out=POR&amp;amp;I dbms=dlm replace;&lt;BR /&gt;1056 datarow=2; delimiter='09'x;&lt;BR /&gt;1057 run;&lt;BR /&gt;1058 %END;&lt;BR /&gt;1059 %MEND POR;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Jun 2018 06:22:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-my-Macro-code-is-not-responding/m-p/468985#M119865</guid>
      <dc:creator>nazmul</dc:creator>
      <dc:date>2018-06-10T06:22:10Z</dc:date>
    </item>
    <item>
      <title>Re: Why my Macro code is not responding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-my-Macro-code-is-not-responding/m-p/468989#M119869</link>
      <description>&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/143540"&gt;@nazmul&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You submitted the macro definition, but forgot to call the macro. That is, you told SAS to compile the macro, but not to execute the compiled code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Actually it was good that you omitted the macro call, because otherwise the log would be full of error messages:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;
&lt;P&gt;As a rule, macro variable references (such as &amp;amp;I) in single quotes are not resolved. So, you should enclose the path in double quotes in order to have the references &amp;amp;I replaced by your date values.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;Your %DO loop would iterate 12312017-3312011+1=9000007 times! Not only would it take a long time to execute nine million PROC IMPORT steps, but most of them would most likely result in error messages (even after the above correction) due to non-existing files, e.g. FFIEC CDR Call Bulk POR 3312019.txt. You should think about a way to loop through the relevant dates rather than through nine million integers (without leading zeros) which SAS does not recognize as dates.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Once you've corrected the macro (and have compiled it again), you may want to call it by simply submitting&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%POR&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Jun 2018 10:03:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-my-Macro-code-is-not-responding/m-p/468989#M119869</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2018-06-10T10:03:10Z</dc:date>
    </item>
    <item>
      <title>Re: Why my Macro code is not responding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-my-Macro-code-is-not-responding/m-p/469455#M120093</link>
      <description>&lt;P&gt;In addition to &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;'s comment you are going to have issues with this line:&lt;/P&gt;
&lt;PRE&gt;proc import datafile='H:\Seminar Class\Banking Seminar\Data by me\Bank Call Report\FFIEC data\FFIEC CDR Call Bulk All Schedules &amp;amp;I/FFIEC CDR Call Bulk POR &amp;amp;I.txt'&lt;/PRE&gt;
&lt;P&gt;For one thing you change from a \ to a / part way through the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A second issue occurs twice: you have &amp;amp;I/ and &amp;amp;i.txt. The . following a macro variable tells SAS that the following text is literal or a separate macro variable to resolve. In some cases the missing . will yield an undesired result an potentially an error if the following character could be part of a macro variable name:&lt;/P&gt;
&lt;PRE&gt;222  %let i= 123;
223  %put &amp;amp;i_;
WARNING: Apparent symbolic reference I_ not resolved.
&amp;amp;i_
&lt;/PRE&gt;
&lt;P&gt;The second is that since you want a .txt at the end the single . gets lost in the macro concatenation:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;226  %let i= 123;
227  %put Wrong: &amp;amp;i.txt;
Wrong: 123txt
228  %put Right: &amp;amp;i..txt;
Right: 123.txt
&lt;/PRE&gt;
&lt;P&gt;You have a logic issue that you are very likely to generate HUNDREDS OF&amp;nbsp;THOUSANDS of incorrect filenames.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since your index values for I are pretty obviously dates then for giggles run this code showing what will happen from 03312011 to 04012011:&lt;/P&gt;
&lt;PRE&gt;%macro dummy;
%DO I = 03312011 %TO 04012011;
%put &amp;amp;i;
%end;
%mend;

%dummy;&lt;/PRE&gt;
&lt;P&gt;And if you examine the results carefully of the above you will notice that the numeric values generate by %DO have no leading zeroes besides creating way too many values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So you actually want to iterate over date values and then use the text with leading 0 as needed. A data _null_ and Call execute can do this as the macro code for directly manipulating those date values will be ugly:&lt;/P&gt;
&lt;PRE&gt;data _null_;
do i='31MAR2011'd to '31DEC2017'd;
   ic = put(i,mmddyyn8.);
   length longstr $ 200;
   longstr = quote(cat('H:\Seminar Class\Banking Seminar\Data by me\Bank Call Report\FFIEC data\FFIEC CDR Call Bulk All Schedules ',ic,'\FFIEC CDR Call Bulk POR ',ic,'.txt'));
   call execute ('Proc Import datafile=');
   call execute (longstr);
   call execute ('out='||cat('POR',ic)||'dbms=dlm replace;');
   call execute ("datarow=2; delimiter='09'x;run;");
end;
run;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Jun 2018 23:26:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-my-Macro-code-is-not-responding/m-p/469455#M120093</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-06-11T23:26:30Z</dc:date>
    </item>
  </channel>
</rss>

