<?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: DI Studio pre-code macro variables not assigning properly in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/DI-Studio-pre-code-macro-variables-not-assigning-properly/m-p/539604#M148712</link>
    <description>It turns out this was absolute human error in that the file being referenced was not the file I was looking at in EGuide. I have accepted your reply &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt; as your reponse will help anyone else having a legitimate issue with %local variables.</description>
    <pubDate>Fri, 01 Mar 2019 12:52:48 GMT</pubDate>
    <dc:creator>_Dan_</dc:creator>
    <dc:date>2019-03-01T12:52:48Z</dc:date>
    <item>
      <title>DI Studio pre-code macro variables not assigning properly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DI-Studio-pre-code-macro-variables-not-assigning-properly/m-p/539579#M148696</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm centralising recurring macro variables and functions into a .sas file which can be called via an %include statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To set the scene, I have a DI Studio job which first runs pre-code and then runs user-written code. The pre-code is a simple %include statement that "sets up" the job specifics.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Centralising the recurring macro variables meant taking those variables out of the pre-code .sas file. Those same variables are now created inside of the centralised file, which is now referenced as another %include statement. That %include statement is nested - I am not calling two .sas files in the pre-code box in DI Studio, I am calling one .sas file, and that .sas file %includes the 'centralised' file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The job now fails because a variable is no longer found. However, if I do %include the separate .sas files in the pre-code box in DI Studio, the job no longer fails.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What's happening:&lt;/P&gt;&lt;P&gt;DI Studio starts the job and calls the %include line in pre-code.&lt;/P&gt;&lt;P&gt;That .sas file runs. The first thing it does is run another %include line, and then attempts to go about doing what it always used to do.&lt;/P&gt;&lt;P&gt;It fails because, apparently, the macro variables created in the nested %include were never created.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But:&lt;/P&gt;&lt;P&gt;DI Studio runs the job and calls both .sas files in separate %include statements.&lt;/P&gt;&lt;P&gt;Each file has run separately.&lt;/P&gt;&lt;P&gt;Job runs fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why is that?&lt;/P&gt;</description>
      <pubDate>Fri, 01 Mar 2019 10:45:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DI-Studio-pre-code-macro-variables-not-assigning-properly/m-p/539579#M148696</guid>
      <dc:creator>_Dan_</dc:creator>
      <dc:date>2019-03-01T10:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: DI Studio pre-code macro variables not assigning properly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DI-Studio-pre-code-macro-variables-not-assigning-properly/m-p/539588#M148702</link>
      <description>&lt;P&gt;Look if there are macro definitions and calls involved that could cause variables to be put into a local symbole table.&lt;/P&gt;
&lt;P&gt;Use &lt;FONT face="courier new,courier"&gt;%put&lt;/FONT&gt; statements that tell you exactly when a certain piece of code is entered and executed.&lt;/P&gt;
&lt;P&gt;Use &lt;FONT face="courier new,courier"&gt;options source2;&lt;/FONT&gt; to have all code in the log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Mar 2019 11:45:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DI-Studio-pre-code-macro-variables-not-assigning-properly/m-p/539588#M148702</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-03-01T11:45:11Z</dc:date>
    </item>
    <item>
      <title>Re: DI Studio pre-code macro variables not assigning properly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DI-Studio-pre-code-macro-variables-not-assigning-properly/m-p/539593#M148706</link>
      <description>Hi Kurt, thanks for your reply.&lt;BR /&gt;&lt;BR /&gt;I have %global statements in the 'centralised' file in an attempt to ensure the variables carry across.&lt;BR /&gt;&lt;BR /&gt;Again, this works when the %include files are called in series within the pre-code box, but not when the %include line is run from within the other %include line...&lt;BR /&gt;&lt;BR /&gt;I will try your suggestions as well.</description>
      <pubDate>Fri, 01 Mar 2019 12:01:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DI-Studio-pre-code-macro-variables-not-assigning-properly/m-p/539593#M148706</guid>
      <dc:creator>_Dan_</dc:creator>
      <dc:date>2019-03-01T12:01:57Z</dc:date>
    </item>
    <item>
      <title>Re: DI Studio pre-code macro variables not assigning properly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DI-Studio-pre-code-macro-variables-not-assigning-properly/m-p/539604#M148712</link>
      <description>It turns out this was absolute human error in that the file being referenced was not the file I was looking at in EGuide. I have accepted your reply &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt; as your reponse will help anyone else having a legitimate issue with %local variables.</description>
      <pubDate>Fri, 01 Mar 2019 12:52:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DI-Studio-pre-code-macro-variables-not-assigning-properly/m-p/539604#M148712</guid>
      <dc:creator>_Dan_</dc:creator>
      <dc:date>2019-03-01T12:52:48Z</dc:date>
    </item>
    <item>
      <title>Re: DI Studio pre-code macro variables not assigning properly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DI-Studio-pre-code-macro-variables-not-assigning-properly/m-p/539607#M148713</link>
      <description>&lt;P&gt;It happens to all of us &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Mar 2019 13:25:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DI-Studio-pre-code-macro-variables-not-assigning-properly/m-p/539607#M148713</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-03-01T13:25:37Z</dc:date>
    </item>
  </channel>
</rss>

