<?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 global macro variable not being resolved in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-global-macro-variable-not-being-resolved/m-p/217437#M40049</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you mean job or step?&lt;/P&gt;&lt;P&gt;Macro variables last only for the duration of the job, so you must save the value in a table or in a flat file for the next job to access it.&lt;/P&gt;&lt;P&gt;If you mean step:&lt;/P&gt;&lt;P&gt;1- The global statement must come before the value assignment.&lt;/P&gt;&lt;P&gt;2- Unless your proc sql runs inside a macro, new_col will always be global&lt;/P&gt;&lt;P&gt;3- Fyi, if the select statement reads no records, no value is assigned&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 05 Aug 2015 21:08:50 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2015-08-05T21:08:50Z</dc:date>
    <item>
      <title>SAS global macro variable not being resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-global-macro-variable-not-being-resolved/m-p/217436#M40048</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have 2 jobs in DI studio. In job 1, I need to define some variables that I need to use in job2.&lt;/P&gt;&lt;P&gt;So in job 1, I do:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc sql ;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;select col1 into :new_col from table1 where 1 = 1;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;quit;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;%global new_col;&lt;/STRONG&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;In job 2:&lt;/P&gt;&lt;P&gt;I try to use the macro variable new_col, but the variable name cannot be resolved.&lt;/P&gt;&lt;P&gt;How to solve this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Aug 2015 19:46:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-global-macro-variable-not-being-resolved/m-p/217436#M40048</guid>
      <dc:creator>eagles_dare13</dc:creator>
      <dc:date>2015-08-05T19:46:54Z</dc:date>
    </item>
    <item>
      <title>Re: SAS global macro variable not being resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-global-macro-variable-not-being-resolved/m-p/217437#M40049</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you mean job or step?&lt;/P&gt;&lt;P&gt;Macro variables last only for the duration of the job, so you must save the value in a table or in a flat file for the next job to access it.&lt;/P&gt;&lt;P&gt;If you mean step:&lt;/P&gt;&lt;P&gt;1- The global statement must come before the value assignment.&lt;/P&gt;&lt;P&gt;2- Unless your proc sql runs inside a macro, new_col will always be global&lt;/P&gt;&lt;P&gt;3- Fyi, if the select statement reads no records, no value is assigned&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Aug 2015 21:08:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-global-macro-variable-not-being-resolved/m-p/217437#M40049</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2015-08-05T21:08:50Z</dc:date>
    </item>
    <item>
      <title>Re: SAS global macro variable not being resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-global-macro-variable-not-being-resolved/m-p/217438#M40050</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure if passing macro variable values between jobs is the best solution, but I don't know the full picture, so...&lt;/P&gt;&lt;P&gt;If those two jobs are always running in sequence you could put them together in the same job (job in job). Then the jobs will execute in the same SAS session.&lt;/P&gt;&lt;P&gt;Another option is to have a routine that stores the macro variable valu&lt;SPAN style="font-size: 13.3333330154419px;"&gt;es in a permanent stored table, and then a a routine that creates macro variables in the new session based on that table. Using SASHELP.VMACRO could be an option...&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Aug 2015 21:33:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-global-macro-variable-not-being-resolved/m-p/217438#M40050</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2015-08-05T21:33:14Z</dc:date>
    </item>
  </channel>
</rss>

