<?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: Macro loop help needed in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-loop-help-needed/m-p/115598#M23814</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One way to wrap the whole thing into a single RSUBMIT/ENDRSUBMIT block.&amp;nbsp; Then the macro is defined on the remote session and runs on the remote session.&amp;nbsp; Make sure to include a ; so that remote session knows to start the macro rather than wait for parameter values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rsubmit;&lt;/P&gt;&lt;P&gt; %macro test;&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;&lt;P&gt; %mend; &lt;/P&gt;&lt;P&gt; %test;&lt;/P&gt;&lt;P&gt;endrsubmit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: I normally also add STATUS=N option to the PROC DOWNLOAD statement to prevent the pop up window with the status showing the percent downloaded.&amp;nbsp; For small files the time to open and close the windows doubles the time to download. For large files I would normally be submitting in background anyway so the status windows are annoying.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 07 Sep 2012 20:30:17 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2012-09-07T20:30:17Z</dc:date>
    <item>
      <title>Macro loop help needed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-loop-help-needed/m-p/115593#M23809</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Greetings all.&amp;nbsp; I am trying to write a macro with a loop to read files on our mainframe, and I have become terribly confused by the macro syntax.&amp;nbsp; Basically there are 20 files I need to read, and they are denoted by a (0) through (-19).&amp;nbsp; Below is the code to manually get each file by changing the file name (Thank you Tom for pointing out the binary variable)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rsubmit;&lt;BR /&gt;FILENAME ezt 'PPPCTK.ZZZ.BALANCED.REVXREC.DSKO745(-0),' DISP=SHR;&lt;BR /&gt;data work.ontime;&lt;BR /&gt; INFILE ezt;&lt;BR /&gt; input &lt;BR /&gt; @1&amp;nbsp;&amp;nbsp; ID_BA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PD6.&lt;BR /&gt; @7&amp;nbsp; CD_BUS&amp;nbsp;&amp;nbsp;&amp;nbsp; $4.&lt;BR /&gt; @16&amp;nbsp; DT_BILL&amp;nbsp;&amp;nbsp;&amp;nbsp; $10.&lt;BR /&gt; @48&amp;nbsp; AT_SVC_UNIT_BILLED PD6.2&lt;BR /&gt; @100 CD_RATE&amp;nbsp;&amp;nbsp;&amp;nbsp; $3.&lt;BR /&gt; @138 CD_REV_SRC&amp;nbsp;&amp;nbsp; $2.&lt;BR /&gt; @154 CD_CYCLE&amp;nbsp;&amp;nbsp; IB2.&lt;BR /&gt; @201 FL_MORE_REV_REC&amp;nbsp; $1.;&lt;BR /&gt; run;&lt;/P&gt;&lt;P&gt; Proc Download Data=work.ontime OUT=work.ontime;&lt;BR /&gt;QUIT;&lt;BR /&gt;Run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, I would like the macro to change the '0' in the parentheses after the file name to every value between 0 and 19, and to create a table in work that is appended with that number.&amp;nbsp; Does this make sense?&amp;nbsp; Is it possible?&amp;nbsp; Do I need to include more info?&amp;nbsp; Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greg&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Sep 2012 20:00:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-loop-help-needed/m-p/115593#M23809</guid>
      <dc:creator>gsnidow</dc:creator>
      <dc:date>2012-09-07T20:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: Macro loop help needed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-loop-help-needed/m-p/115594#M23810</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;%macro test;&lt;BR /&gt;%do i=0 %to 19;&lt;BR /&gt;FILENAME ezt &lt;SPAN style="color: #ff0000;"&gt;"&lt;/SPAN&gt;PPPCTK.ZZZ.BALANCED.REVXREC.DSKO745(-&amp;amp;i)&lt;SPAN style="color: #ff0000;"&gt;,"&lt;/SPAN&gt; DISP=SHR;&lt;BR /&gt;data work.ontime&amp;amp;i;&lt;BR /&gt; INFILE ezt;&lt;BR /&gt; input &lt;BR /&gt;@1&amp;nbsp;&amp;nbsp; ID_BA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PD6.&lt;BR /&gt; @7&amp;nbsp; CD_BUS&amp;nbsp;&amp;nbsp;&amp;nbsp; $4.&lt;BR /&gt; @16&amp;nbsp; DT_BILL&amp;nbsp;&amp;nbsp;&amp;nbsp; $10.&lt;BR /&gt; @48&amp;nbsp; AT_SVC_UNIT_BILLED PD6.2&lt;BR /&gt; @100 CD_RATE&amp;nbsp;&amp;nbsp;&amp;nbsp; $3.&lt;BR /&gt; @138 CD_REV_SRC&amp;nbsp;&amp;nbsp; $2.&lt;BR /&gt; @154 CD_CYCLE&amp;nbsp;&amp;nbsp; IB2.&lt;BR /&gt; @201 FL_MORE_REV_REC&amp;nbsp; $1.;&lt;BR /&gt; run;&lt;/P&gt;&lt;P&gt;Proc Download Data=work.ontime&amp;amp;i OUT=work.ontime&amp;amp;i;&lt;BR /&gt;QUIT;&lt;BR /&gt;Run;&lt;BR /&gt;%end;&lt;BR /&gt;%mend;&lt;BR /&gt;%test&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Sep 2012 20:11:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-loop-help-needed/m-p/115594#M23810</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-09-07T20:11:30Z</dc:date>
    </item>
    <item>
      <title>Re: Macro loop help needed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-loop-help-needed/m-p/115595#M23811</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Unless you want to overwrite the same file nineteen times on both the server and the client, I would assume that you don't always want to call the files 'work.ontime'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do you want to name them?&amp;nbsp; If Linlin's proposed renaming works for you then I would just add one more thing, namely to put your rsubmit statement before the macro declaration and the endrsubmit statement (which you omitted from your example) at the very bottom of the code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Sep 2012 20:14:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-loop-help-needed/m-p/115595#M23811</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-09-07T20:14:34Z</dc:date>
    </item>
    <item>
      <title>Re: Macro loop help needed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-loop-help-needed/m-p/115596#M23812</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Arthur, they need to be named exactly how Linlin has done it.&amp;nbsp; Thanks. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Sep 2012 20:21:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-loop-help-needed/m-p/115596#M23812</guid>
      <dc:creator>gsnidow</dc:creator>
      <dc:date>2012-09-07T20:21:24Z</dc:date>
    </item>
    <item>
      <title>Re: Macro loop help needed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-loop-help-needed/m-p/115597#M23813</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Linlin, thank you for the help.&amp;nbsp; That looks almost exactly what I was trying at one point.&amp;nbsp; It looks like the only thing missing is the Rsubmit, since I am running this on the mainframe first, then downloading the tables to my pc.&amp;nbsp; I tried adding Rsubmit; to the macro, but I get the following error...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference I not resolved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference I not resolved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference I not resolved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference I not resolved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference I not resolved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference I not resolved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference I not resolved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference I not resolved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference I not resolved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference I not resolved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference I not resolved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference I not resolved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference I not resolved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference I not resolved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference I not resolved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference I not resolved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference I not resolved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference I not resolved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference I not resolved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: Remote submit to MVSA complete.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where should I put the Rsubmit within the macro?&amp;nbsp; Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greg&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Sep 2012 20:24:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-loop-help-needed/m-p/115597#M23813</guid>
      <dc:creator>gsnidow</dc:creator>
      <dc:date>2012-09-07T20:24:05Z</dc:date>
    </item>
    <item>
      <title>Re: Macro loop help needed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-loop-help-needed/m-p/115598#M23814</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One way to wrap the whole thing into a single RSUBMIT/ENDRSUBMIT block.&amp;nbsp; Then the macro is defined on the remote session and runs on the remote session.&amp;nbsp; Make sure to include a ; so that remote session knows to start the macro rather than wait for parameter values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rsubmit;&lt;/P&gt;&lt;P&gt; %macro test;&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;&lt;P&gt; %mend; &lt;/P&gt;&lt;P&gt; %test;&lt;/P&gt;&lt;P&gt;endrsubmit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: I normally also add STATUS=N option to the PROC DOWNLOAD statement to prevent the pop up window with the status showing the percent downloaded.&amp;nbsp; For small files the time to open and close the windows doubles the time to download. For large files I would normally be submitting in background anyway so the status windows are annoying.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Sep 2012 20:30:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-loop-help-needed/m-p/115598#M23814</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-09-07T20:30:17Z</dc:date>
    </item>
    <item>
      <title>Re: Macro loop help needed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-loop-help-needed/m-p/115599#M23815</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You never responded to let everyone know whether you got it working.&amp;nbsp; Based on your error, I presume that you didn't change the quotes around the filename, to be double rather than single quotes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Sep 2012 21:38:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-loop-help-needed/m-p/115599#M23815</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-09-07T21:38:14Z</dc:date>
    </item>
    <item>
      <title>Re: Macro loop help needed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-loop-help-needed/m-p/115600#M23816</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Arthur, I did not get it working yet, but I think I have all I need to get it partially working.&amp;nbsp; I have encountered another problem.&amp;nbsp; After 10 generations of the file, it gets archived to another volumne, and when using TSOD to access these files, the user is prompted to type ether a 'Y' or 'N' for whether or not to restore the file.&amp;nbsp; I probably wont' have time to work on it today, but I will certainly post back when/if all works.&amp;nbsp; Thank you. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greg&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Sep 2012 13:31:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-loop-help-needed/m-p/115600#M23816</guid>
      <dc:creator>gsnidow</dc:creator>
      <dc:date>2012-09-10T13:31:42Z</dc:date>
    </item>
    <item>
      <title>Re: Macro loop help needed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-loop-help-needed/m-p/115601#M23817</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Greetings all.&amp;nbsp; It works, and indeed I did not change my single quotes to double quotes as Arthur suggested.&amp;nbsp; I was also missing a semicolon in one spot.&amp;nbsp; Anyhow, thank you all for your valuable help.&amp;nbsp; I still have the issue of being prompted for an input after a certain generation of the file.&amp;nbsp; I can avoid this by simply running this once per week I guess.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greg&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;libname Test 'C:\sas_files\Test';&lt;/P&gt;&lt;P&gt;rsubmit;&lt;/P&gt;&lt;P&gt; %macro test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %do i=0 %to 4;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; FILENAME ezt "PPPCTK.ZZZ.BALANCED.REVXREC.DSKO745(-&amp;amp;i)" DISP=SHR;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; data work.ontime&amp;amp;i;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; INFILE ezt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; input &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; @1&amp;nbsp;&amp;nbsp; ID_BA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PD6.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; @7&amp;nbsp; CD_BUS&amp;nbsp;&amp;nbsp;&amp;nbsp; $4.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; @16&amp;nbsp; DT_BILL&amp;nbsp;&amp;nbsp;&amp;nbsp; $10.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; @48&amp;nbsp; AT_SVC_UNIT_BILLED PD6.2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; @100 CD_RATE&amp;nbsp;&amp;nbsp;&amp;nbsp; $3.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; @138 CD_REV_SRC&amp;nbsp;&amp;nbsp; $2.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; @154 CD_CYCLE&amp;nbsp;&amp;nbsp; IB2.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; @201 FL_MORE_REV_REC&amp;nbsp; $1.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Proc Download Data=work.ontime&amp;amp;i OUT=test.ontime&amp;amp;i;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Run;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %end;&lt;/P&gt;&lt;P&gt; %mend;&lt;/P&gt;&lt;P&gt; %test;&lt;/P&gt;&lt;P&gt;endrsubmit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Sep 2012 17:24:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-loop-help-needed/m-p/115601#M23817</guid>
      <dc:creator>gsnidow</dc:creator>
      <dc:date>2012-09-10T17:24:12Z</dc:date>
    </item>
  </channel>
</rss>

