<?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 SAS Tip: Making Macro Variables READONLY in SAS Tips from the Community</title>
    <link>https://communities.sas.com/t5/SAS-Tips-from-the-Community/SAS-Tip-Making-Macro-Variables-READONLY/m-p/442541#M128</link>
    <description>&lt;P&gt;Did you know that you can now make your Global and Local macro variables READONLY? New options on the &lt;A href="http://go.documentation.sas.com/?docsetId=mcrolref&amp;amp;docsetTarget=p1lhhti7fjxgb1n1fuiubqk11h4d.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;%GLOBAL&lt;/A&gt; and &lt;A href="http://go.documentation.sas.com/?docsetId=mcrolref&amp;amp;docsetTarget=p0ivgabci0y2den1usf43mxdkpgp.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;%LOCAL&lt;/A&gt; statements allow you to not only make variables so that they cannot be inadvertently changed, but you can also assign them initial values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%global/readonly dsn=clinics;

%macro tryit;
  %local dsn;
  %* does other stuff;
%mend tryit;

%* The macro %TRYIT will fail;
%tryit &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The use of these options can help you avoid &lt;A href=" http://www.caloxy.com/papers/62_TT04.pdf " target="_self"&gt;macro variable collisions&lt;/A&gt;, but there are dangers. Once specified as &lt;STRONG&gt;readonly&lt;/STRONG&gt;, you can no longer create local versions of this macro variable. This can be a big problem if a called macro also attempts to create another instance of the macro variable - even using the %LOCAL statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;
&lt;P&gt;Thanks to Art Carpenter&amp;nbsp;for sharing this tip on sasCommunity.org.&lt;/P&gt;</description>
    <pubDate>Wed, 21 Mar 2018 14:27:20 GMT</pubDate>
    <dc:creator>SAS_Tipster</dc:creator>
    <dc:date>2018-03-21T14:27:20Z</dc:date>
    <item>
      <title>SAS Tip: Making Macro Variables READONLY</title>
      <link>https://communities.sas.com/t5/SAS-Tips-from-the-Community/SAS-Tip-Making-Macro-Variables-READONLY/m-p/442541#M128</link>
      <description>&lt;P&gt;Did you know that you can now make your Global and Local macro variables READONLY? New options on the &lt;A href="http://go.documentation.sas.com/?docsetId=mcrolref&amp;amp;docsetTarget=p1lhhti7fjxgb1n1fuiubqk11h4d.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;%GLOBAL&lt;/A&gt; and &lt;A href="http://go.documentation.sas.com/?docsetId=mcrolref&amp;amp;docsetTarget=p0ivgabci0y2den1usf43mxdkpgp.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;%LOCAL&lt;/A&gt; statements allow you to not only make variables so that they cannot be inadvertently changed, but you can also assign them initial values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%global/readonly dsn=clinics;

%macro tryit;
  %local dsn;
  %* does other stuff;
%mend tryit;

%* The macro %TRYIT will fail;
%tryit &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The use of these options can help you avoid &lt;A href=" http://www.caloxy.com/papers/62_TT04.pdf " target="_self"&gt;macro variable collisions&lt;/A&gt;, but there are dangers. Once specified as &lt;STRONG&gt;readonly&lt;/STRONG&gt;, you can no longer create local versions of this macro variable. This can be a big problem if a called macro also attempts to create another instance of the macro variable - even using the %LOCAL statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;
&lt;P&gt;Thanks to Art Carpenter&amp;nbsp;for sharing this tip on sasCommunity.org.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Mar 2018 14:27:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Tips-from-the-Community/SAS-Tip-Making-Macro-Variables-READONLY/m-p/442541#M128</guid>
      <dc:creator>SAS_Tipster</dc:creator>
      <dc:date>2018-03-21T14:27:20Z</dc:date>
    </item>
  </channel>
</rss>

