<?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: global macro variable using call symput in macro defintion in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/global-macro-variable-using-call-symput-in-macro-defintion/m-p/167970#M263971</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;&amp;nbsp; There is a search path that is used to determine whether you create your macro variable in a GLOBAL or LOCAL table. You need to read about it in the documentation. When inside a macro that does not otherwise need/create a local table, your macro variable will be written to the global table. The beauty of CALL SYMPUTX is that you can CONTROL where the macro variable will be written. See the attached screen shot. The 3rd argument to the call routine allows you to specify a string that is the location: "L" for local or "G" for global or Your macro definition does not use or create a LOCAL symbol table. 'F' means write it in the most local table IF the macro variable is found. Look at the attached screen shot for an example of using 'L' and 'G' -- that's where I would recommend starting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/11611i997ECCF00AC4BC33/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="force_write_local_or_global.png" title="force_write_local_or_global.png" /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 06 Jul 2014 23:36:31 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2014-07-06T23:36:31Z</dc:date>
    <item>
      <title>global macro variable using call symput in macro defintion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/global-macro-variable-using-call-symput-in-macro-defintion/m-p/167969#M263970</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;% macro test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; call symputx('name', 'Philip')&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%mend test;&lt;/P&gt;&lt;P&gt;%test&lt;/P&gt;&lt;P&gt;%put _global_;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I thought call symputx creates local macro variable in the macro definition.&amp;nbsp; After checking name is global macro variable.&amp;nbsp; I appreciate clarification in this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 06 Jul 2014 21:42:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/global-macro-variable-using-call-symput-in-macro-defintion/m-p/167969#M263970</guid>
      <dc:creator>kaushal2040</dc:creator>
      <dc:date>2014-07-06T21:42:47Z</dc:date>
    </item>
    <item>
      <title>Re: global macro variable using call symput in macro defintion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/global-macro-variable-using-call-symput-in-macro-defintion/m-p/167970#M263971</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;&amp;nbsp; There is a search path that is used to determine whether you create your macro variable in a GLOBAL or LOCAL table. You need to read about it in the documentation. When inside a macro that does not otherwise need/create a local table, your macro variable will be written to the global table. The beauty of CALL SYMPUTX is that you can CONTROL where the macro variable will be written. See the attached screen shot. The 3rd argument to the call routine allows you to specify a string that is the location: "L" for local or "G" for global or Your macro definition does not use or create a LOCAL symbol table. 'F' means write it in the most local table IF the macro variable is found. Look at the attached screen shot for an example of using 'L' and 'G' -- that's where I would recommend starting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/11611i997ECCF00AC4BC33/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="force_write_local_or_global.png" title="force_write_local_or_global.png" /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 06 Jul 2014 23:36:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/global-macro-variable-using-call-symput-in-macro-defintion/m-p/167970#M263971</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2014-07-06T23:36:31Z</dc:date>
    </item>
  </channel>
</rss>

