<?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: SAS Macro help in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Macro-help/m-p/117900#M9917</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Art and Doc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not entirely sure why it ran out of disk space either. However, not sure I was clear enough with my initial post. While the code I presented to you was running in one instance of EG, I began running code locally on another instance of EG (for a different project). The local code was probably what made it run out of disk space. But I'm not knowledgeable enough regarding SAS to know how that would impact my pass through query. Like you said, I had thought that the pass through query would be executing entirely on DB2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But, thanks for the tips. It warns me that the file may now be corrupted when I open it. So I think I will re-run it in it's entirety on DB2 and create a new table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Srikar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 22 Feb 2013 16:41:54 GMT</pubDate>
    <dc:creator>SrikarA</dc:creator>
    <dc:date>2013-02-22T16:41:54Z</dc:date>
    <item>
      <title>SAS Macro help</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Macro-help/m-p/117897#M9914</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I currently have a macro that will pull data while iterating through months and regions, indexes on the source data table I am pulling from. However, another instance of SAS EG crashed mid way through and I got the following error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13614816798571129" jivemacro_uid="_13614816798571129"&gt;
&lt;P&gt;M=18 R=4 M*R=72&lt;/P&gt;
&lt;P&gt;ERROR: Write to WORK._tf1133.UTILITY failed. File is full and may be damaged.&lt;/P&gt;
&lt;P&gt;NOTE: Error was encountered during utility-file processing. You may be able to execute the SQL &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; statement successfully if you allocate more space to the WORK library.&lt;/P&gt;
&lt;P&gt;NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.&lt;/P&gt;
&lt;P&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/P&gt;
&lt;P&gt;NOTE: PROCEDURE SQL 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; 10:56.84&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; 38.61 seconds&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;While I closed out the other SAS project I had and re-started it, the SQL code kept running and iterated through the next month and region. (M=18 and R=5). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, in essence, my SQL macro will run through all 24 months and 8 regions and insert the data into a table. The one missing iteration would be M=18, and R=4, M*R = 72.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there an efficient way to run the code such that only the results from this iteration can be placed into the existing table? If so, I would appreciate any help! My initial thought was to remove the loop and set the variables to what I need them to be. But not sure if that works? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's the macro:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13614818874777926" jivemacro_uid="_13614818874777926" modifiedtitle="true"&gt;
&lt;P&gt;%macro queryloop;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;%do m = 1 %to 24; /* month */&lt;/P&gt;
&lt;P&gt;%do r = 1 %to 8;&amp;nbsp; /* regions */&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;%put M=&amp;amp;m R=&amp;amp;r M*R=%eval(&amp;amp;m * &amp;amp;r);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;/P&gt;
&lt;P&gt;connect to odbc(datasrc=db2);&lt;/P&gt;
&lt;P&gt;%if &amp;amp;m * &amp;amp;r = 1 %then create table myTable as;&lt;/P&gt;
&lt;P&gt;%else insert into myTable;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;select * from connection to odbc&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;select&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&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; FirstName,&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; LastName,&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; Occupation,&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; Sum(Salary) as Income,&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; Sum(Exp_Amt) as Expenses,&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; Location,&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; Car&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;FROM SourceTable D&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;WHERE D.Pay_Dt between &amp;amp;&amp;amp;start&amp;amp;m and &amp;amp;&amp;amp;stop&amp;amp;m&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; and regn_cd = &amp;amp;&amp;amp;regn&amp;amp;r&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;group by&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&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; FirstName,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &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; LastName,&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; Occupation,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Location,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &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; Car&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;where LastName in (select Surname from ListofLastNames)&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;%end;&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;%mend;&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;%queryloop;&lt;/P&gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Feb 2013 21:29:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Macro-help/m-p/117897#M9914</guid>
      <dc:creator>SrikarA</dc:creator>
      <dc:date>2013-02-21T21:29:37Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro help</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Macro-help/m-p/117898#M9915</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why does the one fail?&amp;nbsp; From your description I thought you were going to ask what to add to skip that iteration but, instead, you are asking how to run just it.&amp;nbsp; Thus the answer to the question of why it fails is important.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Feb 2013 22:34:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Macro-help/m-p/117898#M9915</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2013-02-21T22:34:02Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro help</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Macro-help/m-p/117899#M9916</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Art,&amp;nbsp; The likely reason it failed is that it ran out of disk space on that one iteration.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Srikar, Unless you fix the underlying problem a single iteration will also fail.&amp;nbsp; It may be safer to re-run the entire thing and re-create the table in DB2; it may take a while but it is safer than modifying the code.&amp;nbsp; I find it curious that it ran out of disk space; from the code you presented, this looks like a pass-through query that should execute entirely on DB2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The reason that the pass-through SQL continued to run on DB2 is that when you hand off to DB2, you don't get control back until DB2 is ready.&amp;nbsp; You can kill EGuide, but it doesn't kill the underlying DB2 process (you have to call the DB2 admin to get that done).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Doc Muhlbaier&lt;/P&gt;&lt;P&gt;Duke&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Feb 2013 14:13:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Macro-help/m-p/117899#M9916</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2013-02-22T14:13:40Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro help</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Macro-help/m-p/117900#M9917</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Art and Doc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not entirely sure why it ran out of disk space either. However, not sure I was clear enough with my initial post. While the code I presented to you was running in one instance of EG, I began running code locally on another instance of EG (for a different project). The local code was probably what made it run out of disk space. But I'm not knowledgeable enough regarding SAS to know how that would impact my pass through query. Like you said, I had thought that the pass through query would be executing entirely on DB2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But, thanks for the tips. It warns me that the file may now be corrupted when I open it. So I think I will re-run it in it's entirety on DB2 and create a new table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Srikar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Feb 2013 16:41:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Macro-help/m-p/117900#M9917</guid>
      <dc:creator>SrikarA</dc:creator>
      <dc:date>2013-02-22T16:41:54Z</dc:date>
    </item>
  </channel>
</rss>

