<?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 Why the 'RUN' statement must be taken out in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Why-the-RUN-statement-must-be-taken-out/m-p/23928#M5380</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Hi art297, thanks for your code. My task is to send 5 emails separately, with one place each time. Your code simply sends all 5 places in a single email.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 Jan 2012 16:32:10 GMT</pubDate>
    <dc:creator>bncoxuk</dc:creator>
    <dc:date>2012-01-04T16:32:10Z</dc:date>
    <item>
      <title>Why the 'RUN' statement must be taken out</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Why-the-RUN-statement-must-be-taken-out/m-p/23923#M5375</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #ff6600;"&gt;Please have a look at the following code:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FILENAME newemail EMAIL TO="&lt;A href="mailto:xxx@xxx.com"&gt;xxx@xxx.com&lt;/A&gt;" SENDER="xx" SUBJECT="Place to go";&lt;/P&gt;&lt;P&gt;%MACRO sender;&lt;BR /&gt;&amp;nbsp; %DO i=1 %TO 5;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Timer=SLEEP(2); /*Wait for 20 mins*/&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATA _NULL_;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET work.place(WHERE=(min=minute(timepart(datetime()))));&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FILE newemail;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PUT "Now go to: " place;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; RUN;&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp; %END;&lt;BR /&gt;FILENAME newemail CLEAR;&lt;BR /&gt;%MEND;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%sender&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;Because of the RUN statement, SAS produced the following error message:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;9&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; Timer=SLEEP(2);&lt;BR /&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; -----&lt;BR /&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; 180&lt;BR /&gt;MPRINT(SENDER):&amp;nbsp;&amp;nbsp; Timer=SLEEP(2);&lt;/P&gt;&lt;P&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;If the RUN statement is removed, then it worked perfectly. Why this happened? &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jan 2012 15:58:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Why-the-RUN-statement-must-be-taken-out/m-p/23923#M5375</guid>
      <dc:creator>bncoxuk</dc:creator>
      <dc:date>2012-01-04T15:58:14Z</dc:date>
    </item>
    <item>
      <title>Re: Why the 'RUN' statement must be taken out</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Why-the-RUN-statement-must-be-taken-out/m-p/23924#M5376</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The error isn't because of the run statement .. it is because you are trying to assign a variable outside of a datastep.&amp;nbsp; Try removing the Timer=&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jan 2012 16:01:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Why-the-RUN-statement-must-be-taken-out/m-p/23924#M5376</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-01-04T16:01:40Z</dc:date>
    </item>
    <item>
      <title>Why the 'RUN' statement must be taken out</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Why-the-RUN-statement-must-be-taken-out/m-p/23925#M5377</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try adding a RUN; statement before you call the macro and you will get the error message again.&lt;/P&gt;&lt;P&gt;Turn on the MPRINT option and you will see what code the macro is generating and the issue will be more obvious.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You have an assignment statement BEFORE your DATA step starts.&amp;nbsp; By removing the RUN statement SAS is happily using that statement into the DATA step from the previous iteration of you macro do loop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jan 2012 16:03:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Why-the-RUN-statement-must-be-taken-out/m-p/23925#M5377</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-01-04T16:03:45Z</dc:date>
    </item>
    <item>
      <title>Why the 'RUN' statement must be taken out</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Why-the-RUN-statement-must-be-taken-out/m-p/23926#M5378</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Plus, for what you are doing, I don't think you need either a macro or the matching of a timestamp.&amp;nbsp; Couldn't you just use something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;FILENAME newemail EMAIL TO="&lt;/SPAN&gt;&lt;A class="jive-link-email-small" href="mailto:atabachneck@gmail.com"&gt;atabachneck@gmail.com&lt;/A&gt;&lt;SPAN&gt;" SENDER="&lt;/SPAN&gt;&lt;A class="jive-link-email-small" href="mailto:art297@rogers.com"&gt;art297@rogers.com&lt;/A&gt;&lt;SPAN&gt;" SUBJECT="Place to go";&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;data place;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input place $;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;C&lt;/P&gt;&lt;P&gt;B&lt;/P&gt;&lt;P&gt;D&lt;/P&gt;&lt;P&gt;E&lt;/P&gt;&lt;P&gt;A&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA _NULL_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; SET work.place;&lt;/P&gt;&lt;P&gt;&amp;nbsp; timer=SLEEP(2); /*Wait for 2 seconds*/&lt;/P&gt;&lt;P&gt;&amp;nbsp; FILE newemail;&lt;/P&gt;&lt;P&gt;&amp;nbsp; PUT "Now go to: " place;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FILENAME newemail CLEAR;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jan 2012 16:21:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Why-the-RUN-statement-must-be-taken-out/m-p/23926#M5378</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-01-04T16:21:50Z</dc:date>
    </item>
    <item>
      <title>Why the 'RUN' statement must be taken out</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Why-the-RUN-statement-must-be-taken-out/m-p/23927#M5379</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot art297 and Tom. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; A very silly mistake. I will need to learn macro. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jan 2012 16:25:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Why-the-RUN-statement-must-be-taken-out/m-p/23927#M5379</guid>
      <dc:creator>bncoxuk</dc:creator>
      <dc:date>2012-01-04T16:25:02Z</dc:date>
    </item>
    <item>
      <title>Why the 'RUN' statement must be taken out</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Why-the-RUN-statement-must-be-taken-out/m-p/23928#M5380</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Hi art297, thanks for your code. My task is to send 5 emails separately, with one place each time. Your code simply sends all 5 places in a single email.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jan 2012 16:32:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Why-the-RUN-statement-must-be-taken-out/m-p/23928#M5380</guid>
      <dc:creator>bncoxuk</dc:creator>
      <dc:date>2012-01-04T16:32:10Z</dc:date>
    </item>
    <item>
      <title>Why the 'RUN' statement must be taken out</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Why-the-RUN-statement-must-be-taken-out/m-p/23929#M5381</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;art297,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you code is more simple than the macro used. If I want to send one place at a time, how should I adapt your code?&amp;nbsp; The task is to send 5 emails separately, with one place each time&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jan 2012 16:56:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Why-the-RUN-statement-must-be-taken-out/m-p/23929#M5381</guid>
      <dc:creator>bncoxuk</dc:creator>
      <dc:date>2012-01-04T16:56:12Z</dc:date>
    </item>
    <item>
      <title>Why the 'RUN' statement must be taken out</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Why-the-RUN-statement-must-be-taken-out/m-p/23930#M5382</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not able to test sending emails, thus I can only guess.&amp;nbsp; I think you can still simplify it, but use a macro.&amp;nbsp; e.g.:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%MACRO sendit;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %DO i=1 %TO 5;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FILENAME newemail EMAIL TO="&lt;/SPAN&gt;&lt;A class="jive-link-email-small" href="mailto:xxx@xxx.com"&gt;xxx@xxx.com&lt;/A&gt;&lt;SPAN&gt;" SENDER="xx" SUBJECT="Place to go";&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATA _NULL_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET work.place(firstobs=&amp;amp;i. obs=&amp;amp;i.);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FILE newemail;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PUT "Now go to: " place;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Timer=SLEEP(2); /*Wait for 2 seconds*/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FILENAME newemail CLEAR;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %END;&lt;/P&gt;&lt;P&gt;%MEND;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%sendit&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not sure why, but I wasn't able to use the macro name sender, so I changed it to sendit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jan 2012 17:09:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Why-the-RUN-statement-must-be-taken-out/m-p/23930#M5382</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-01-04T17:09:51Z</dc:date>
    </item>
    <item>
      <title>Why the 'RUN' statement must be taken out</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Why-the-RUN-statement-must-be-taken-out/m-p/23931#M5383</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, the code worked perfectly. Everytime I received good help and learned from you. Thanks a lot!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jan 2012 17:34:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Why-the-RUN-statement-must-be-taken-out/m-p/23931#M5383</guid>
      <dc:creator>bncoxuk</dc:creator>
      <dc:date>2012-01-04T17:34:03Z</dc:date>
    </item>
  </channel>
</rss>

