<?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 Global macro variable in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Global-macro-variable/m-p/12249#M1603</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't think so. If the PROC SQL statement which creates and populates the macro variable is in open code (not macro-generated), the macro variable is global by default. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New; color: #000080;"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;sql&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;noprint&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;&lt;SPAN style="color: #0000ff;"&gt;select&lt;/SPAN&gt; max(age) &lt;SPAN style="color: #0000ff;"&gt;into&lt;/SPAN&gt; : datebig &lt;SPAN style="color: #0000ff;"&gt;from&lt;/SPAN&gt; sashelp.class ;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New; color: #000080;"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;&lt;SPAN style="color: #0000ff;"&gt;%put&lt;/SPAN&gt; _user_ ;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;&lt;SPAN style="color: #0000ff;"&gt;%symdel&lt;/SPAN&gt; datebig ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course if the SQL code IS macro-generated, the default scope takes effect and you do not get a global.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;&lt;SPAN style="color: #000080;"&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;STRONG&gt;&lt;EM&gt;amacro&lt;/EM&gt;&lt;/STRONG&gt; ;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;proc sql noprint ;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;select max(age) into : datebig from sashelp.class ;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;quit ;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New; color: #000080;"&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;%&lt;STRONG&gt;&lt;EM&gt;amacro&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;&lt;SPAN style="color: #0000ff;"&gt;%put&lt;/SPAN&gt; _user_ ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To force a global, the %GLOBAL statement has to preceed the SQL statement, but it can be within the boundaries of the PROC SQL step.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;&lt;SPAN style="color: #000080;"&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;STRONG&gt;&lt;EM&gt;amacro&lt;/EM&gt;&lt;/STRONG&gt; ;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;proc sql noprint ;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;&lt;SPAN style="color: #0000ff;"&gt;%global&lt;/SPAN&gt; datebig ;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;select max(age) into : datebig from sashelp.class ;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;quit ;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New; color: #000080;"&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;%&lt;STRONG&gt;&lt;EM&gt;amacro&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;&lt;SPAN style="color: #0000ff;"&gt;%put&lt;/SPAN&gt; _user_ ;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;&lt;SPAN style="color: #0000ff;"&gt;%symdel&lt;/SPAN&gt; datebig ;&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;&lt;P&gt;Ksharp wrote:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another implying problem is that macro variable&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;&amp;amp;datebig &lt;/SPAN&gt;is local not golbal,which 's lifetime is only for proc sql.&lt;/P&gt;&lt;P&gt;SO you need to adjust it to make it global.&lt;/P&gt;&lt;P&gt;Such as outside before proc sql.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%global datebig;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;.....................&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 21 Sep 2011 21:47:45 GMT</pubDate>
    <dc:creator>Howles</dc:creator>
    <dc:date>2011-09-21T21:47:45Z</dc:date>
    <item>
      <title>Global macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Global-macro-variable/m-p/12240#M1594</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello SAS users.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a question about global macro variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to obtain a global macro called &lt;EM&gt;N&lt;/EM&gt; which needs to be the number of quarters there are between today and the minimum of &lt;EM&gt;enquiry_date&lt;/EM&gt; variable from the &lt;STRONG&gt;&lt;EM&gt;sample&lt;/EM&gt;&lt;/STRONG&gt; dataset. &lt;/P&gt;&lt;P&gt;Note, I want to use &lt;EM&gt;N&lt;/EM&gt; as an upper bound of the DO loop of several macros so I do not have to count &lt;EM&gt;N&lt;/EM&gt; manually everytime I run my code. The following is what I do:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: green; font-size: 10pt;"&gt;*Today's Date;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;%LET&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; dataend = 19sep2011;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: green; font-size: 10pt;"&gt;*Extracting the earliest enquiry date and write the date into a macro variable called datebig from the sample dataset;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;PROC&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;SQL&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;SELECT&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; MIN(enquiry_date) &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;INTO&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;: datebig&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;FROM&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; sample;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;QUIT&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: green; font-size: 10pt;"&gt;*Calculate N;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;%MACRO&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; &lt;STRONG&gt;&lt;EM&gt;C&lt;/EM&gt;&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;%LET&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; N=ceil((&amp;amp;dataend-&amp;amp;datebig)/(365.25/4));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;%PUT&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; &amp;amp;N;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;%MEND&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; C;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;%&lt;STRONG&gt;&lt;EM&gt;C&lt;/EM&gt;&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;This is not running properly. From my log, it seems that SAS is not recognising &lt;EM&gt;&amp;amp;datebig&lt;/EM&gt; as a numeric variable..&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;Any ideas? &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Sep 2011 01:14:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Global-macro-variable/m-p/12240#M1594</guid>
      <dc:creator>willy0625</dc:creator>
      <dc:date>2011-09-20T01:14:22Z</dc:date>
    </item>
    <item>
      <title>Global macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Global-macro-variable/m-p/12241#M1595</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Assuming enquiry_date is actually a date field, I think SAS may not be recognizing &lt;SPAN style="background-color: white; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;dataend as a date variable. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;try &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;%LET&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt; dataend = '19sep2011'd;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;and rerun. &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Sep 2011 02:01:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Global-macro-variable/m-p/12241#M1595</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2011-09-20T02:01:18Z</dc:date>
    </item>
    <item>
      <title>Global macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Global-macro-variable/m-p/12242#M1596</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think the program need to define the macro variable as date and&amp;nbsp; call %sysfunc to conduct the calculation.&amp;nbsp; I modify the program with bold characters. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Johnson&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%LET dataend = &lt;STRONG&gt;'19sep2011'd&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt; &lt;BR /&gt;*Extracting the earliest enquiry date and write the date into a macro variable called datebig from the sample dataset;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SELECT MIN(enquiry_date) INTO: datebig&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM sample;&lt;/P&gt;&lt;P&gt;QUIT;&lt;/P&gt;&lt;P&gt; &lt;BR /&gt;*Calculate N;&lt;/P&gt;&lt;P&gt;%MACRO C;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %LET N&lt;STRONG&gt;=%sysfunc&lt;/STRONG&gt;(ceil((&amp;amp;dataend-&amp;amp;datebig)/(365.25/4)));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %PUT &amp;amp;N = ;&lt;/P&gt;&lt;P&gt;%MEND C;&lt;/P&gt;&lt;P&gt; &lt;BR /&gt;%C;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Sep 2011 03:06:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Global-macro-variable/m-p/12242#M1596</guid>
      <dc:creator>JohnsonIp</dc:creator>
      <dc:date>2011-09-20T03:06:37Z</dc:date>
    </item>
    <item>
      <title>Global macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Global-macro-variable/m-p/12243#M1597</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi There,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are a number of ways you can do this. One way is to treat the macro variable as text (as that is what it is) and then in your SAS code use it as a SAS date constant. You need to have double quotes around the dataend macro variable so that it is resolved by the macro compiler. See your original code below with my changes in bold...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However a better way would be to use the SAS intck function where you can specify "qtr" as the interval rather than the calculation you have specified as this way leap years are calculated more accurately. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e.g. %LET N=%sysfunc(intck("qtr",&amp;amp;datebig,"&amp;amp;dataend"d));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Michelle&lt;/P&gt;&lt;P&gt;------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: green; font-size: 10pt;"&gt;*Today's Date;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;%LET&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; dataend = 19sep2011;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; height: 8pt;"&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: green; font-size: 10pt;"&gt;*Extracting the earliest enquiry date and write the date into a macro variable called datebig from the sample dataset;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;PROC&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;SQL&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;SELECT&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; MIN(enquiry_date) &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;INTO&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;: datebig&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;FROM&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; sample;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;QUIT&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; height: 8pt;"&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: green; font-size: 10pt;"&gt;*Calculate N;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;%MACRO&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; &lt;STRONG&gt;&lt;EM&gt;C&lt;/EM&gt;&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;%LET&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; N=ceil((&lt;STRONG&gt;"&amp;amp;dataend"d&lt;/STRONG&gt;-&amp;amp;datebig)/(365.25/4));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;%PUT&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; &amp;amp;N;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;%MEND&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; C;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; height: 8pt;"&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;%&lt;STRONG&gt;&lt;EM&gt;C&lt;/EM&gt;&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; height: 8pt;"&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Sep 2011 05:32:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Global-macro-variable/m-p/12243#M1597</guid>
      <dc:creator>MichelleHomes</dc:creator>
      <dc:date>2011-09-20T05:32:07Z</dc:date>
    </item>
    <item>
      <title>Global macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Global-macro-variable/m-p/12244#M1598</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hopefully you have your answer with the INTCK function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In fact you should be able to get the number you want just from the SQL query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SELECT inctck('QTR',MIN(enquiry_date),today()) INTO :N&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM sample;&lt;/P&gt;&lt;P&gt;QUIT;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Sep 2011 13:58:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Global-macro-variable/m-p/12244#M1598</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2011-09-20T13:58:08Z</dc:date>
    </item>
    <item>
      <title>Global macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Global-macro-variable/m-p/12245#M1599</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have already received an answer regarding how to correct your macro to accomplish what you are trying to do but, since some have suggested the intck function, I have a couple of questions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The intck function, by itself, will NOT give you the same answer as your current method.&amp;nbsp; Are you trying to identify number of quarters based on jan1-mar31, apr1-jun30, etc., OR is Sep19 the start or end of a quarter?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And, do you just need the calculation for the one range, or are you going to be calculating it for all of your records?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are defining quarters based on the Sep19-Dec18, Dec19-Mar18, etc. definition, and need to do it for all of your dates, I'd recommend using the intck function but combining it with the method suggested in the following thread: &lt;A _jive_internal="true" href="https://communities.sas.com/message/104501#104501"&gt;http://communities.sas.com/message/104501#104501&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Sep 2011 14:54:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Global-macro-variable/m-p/12245#M1599</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-09-20T14:54:32Z</dc:date>
    </item>
    <item>
      <title>Global macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Global-macro-variable/m-p/12246#M1600</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Hi art297.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was wondering about this actually.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I mean by quarters is based on the calendar - jan1-mar31(1st quarter), apr1-jun30(2nd quarter), ... etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So if we start from September the 19th, this falls in the 3rd quarter of 2011.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, I would be using this method for a much bigger dataset with abou 14,000,000 obervations and hence 14,000,000 enquiry dates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you Michelle and Tom for the intck function and also art for reminding me of the quarter issue.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Sep 2011 22:50:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Global-macro-variable/m-p/12246#M1600</guid>
      <dc:creator>willy0625</dc:creator>
      <dc:date>2011-09-20T22:50:11Z</dc:date>
    </item>
    <item>
      <title>Global macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Global-macro-variable/m-p/12247#M1601</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Then, definitely, the intck function is what you need.&amp;nbsp; Your corrected original macro would not have provided the correct answer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Sep 2011 22:58:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Global-macro-variable/m-p/12247#M1601</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-09-20T22:58:02Z</dc:date>
    </item>
    <item>
      <title>Global macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Global-macro-variable/m-p/12248#M1602</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Another implying problem is that macro variable&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;&amp;amp;datebig &lt;/SPAN&gt;is local not golbal,which 's lifetime is only for proc sql.&lt;/P&gt;&lt;P&gt;SO you need to adjust it to make it global.&lt;/P&gt;&lt;P&gt;Such as outside before proc sql.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%global datebig;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;.....................&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Sep 2011 06:39:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Global-macro-variable/m-p/12248#M1602</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-09-21T06:39:06Z</dc:date>
    </item>
    <item>
      <title>Global macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Global-macro-variable/m-p/12249#M1603</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't think so. If the PROC SQL statement which creates and populates the macro variable is in open code (not macro-generated), the macro variable is global by default. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New; color: #000080;"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;sql&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;noprint&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;&lt;SPAN style="color: #0000ff;"&gt;select&lt;/SPAN&gt; max(age) &lt;SPAN style="color: #0000ff;"&gt;into&lt;/SPAN&gt; : datebig &lt;SPAN style="color: #0000ff;"&gt;from&lt;/SPAN&gt; sashelp.class ;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New; color: #000080;"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;&lt;SPAN style="color: #0000ff;"&gt;%put&lt;/SPAN&gt; _user_ ;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;&lt;SPAN style="color: #0000ff;"&gt;%symdel&lt;/SPAN&gt; datebig ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course if the SQL code IS macro-generated, the default scope takes effect and you do not get a global.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;&lt;SPAN style="color: #000080;"&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;STRONG&gt;&lt;EM&gt;amacro&lt;/EM&gt;&lt;/STRONG&gt; ;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;proc sql noprint ;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;select max(age) into : datebig from sashelp.class ;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;quit ;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New; color: #000080;"&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;%&lt;STRONG&gt;&lt;EM&gt;amacro&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;&lt;SPAN style="color: #0000ff;"&gt;%put&lt;/SPAN&gt; _user_ ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To force a global, the %GLOBAL statement has to preceed the SQL statement, but it can be within the boundaries of the PROC SQL step.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;&lt;SPAN style="color: #000080;"&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;STRONG&gt;&lt;EM&gt;amacro&lt;/EM&gt;&lt;/STRONG&gt; ;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;proc sql noprint ;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;&lt;SPAN style="color: #0000ff;"&gt;%global&lt;/SPAN&gt; datebig ;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;select max(age) into : datebig from sashelp.class ;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;quit ;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New; color: #000080;"&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;%&lt;STRONG&gt;&lt;EM&gt;amacro&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;&lt;SPAN style="color: #0000ff;"&gt;%put&lt;/SPAN&gt; _user_ ;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier New;"&gt;&lt;SPAN style="color: #0000ff;"&gt;%symdel&lt;/SPAN&gt; datebig ;&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;&lt;P&gt;Ksharp wrote:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another implying problem is that macro variable&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;&amp;amp;datebig &lt;/SPAN&gt;is local not golbal,which 's lifetime is only for proc sql.&lt;/P&gt;&lt;P&gt;SO you need to adjust it to make it global.&lt;/P&gt;&lt;P&gt;Such as outside before proc sql.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%global datebig;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;.....................&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Sep 2011 21:47:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Global-macro-variable/m-p/12249#M1603</guid>
      <dc:creator>Howles</dc:creator>
      <dc:date>2011-09-21T21:47:45Z</dc:date>
    </item>
    <item>
      <title>Global macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Global-macro-variable/m-p/12250#M1604</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Howles.&lt;/P&gt;&lt;P&gt;Yes. I tested it. It is global in log.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But Sometimes, When code sql without %global, SAS looks like can not&amp;nbsp; solve it generated by sql.&lt;/P&gt;&lt;P&gt;It is so weird. So I usually declare %global before sql to make sure it is golbal.&lt;/P&gt;&lt;P&gt;I don't know why it will happen ? Maybe My sas 's version&amp;nbsp; is too low.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Sep 2011 03:28:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Global-macro-variable/m-p/12250#M1604</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-09-22T03:28:30Z</dc:date>
    </item>
    <item>
      <title>Global macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Global-macro-variable/m-p/12251#M1605</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What you experienced is most likely because the query did not match any observations.&amp;nbsp; If you use SQL to create a macro variable and the query does not match any records then SQL does not create the macro variable.&amp;nbsp; I usually just use a %LET before the query to set the value that I want if the query does not macth any observations.&amp;nbsp; Using %global has other side effects, the worst being errors when the requested macro variable name already exists in a currently active local scope.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font: 10px Courier New;"&gt;proc sql noprint ;&lt;/P&gt;&lt;P style="font: 10px Courier New;"&gt;&lt;SPAN style="color: #0000ff;"&gt;%let &lt;/SPAN&gt;datebig=;&lt;/P&gt;&lt;P style="font: 10px Courier New;"&gt;&amp;nbsp; select max(age) into : datebig from sashelp.class ;&lt;/P&gt;&lt;P style="font: 10px Courier New;"&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Sep 2011 11:02:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Global-macro-variable/m-p/12251#M1605</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2011-09-22T11:02:00Z</dc:date>
    </item>
    <item>
      <title>Global macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Global-macro-variable/m-p/12252#M1606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tom.&lt;/P&gt;&lt;P&gt;Could you explain what other side effects %golbal will generate?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2011 02:23:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Global-macro-variable/m-p/12252#M1606</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-09-23T02:23:43Z</dc:date>
    </item>
    <item>
      <title>Global macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Global-macro-variable/m-p/12253#M1607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;UL&gt;&lt;LI&gt;If the macro variable already exists the %GLOBAL does not change its value.&amp;nbsp; In this piece of code the intent was to initialize the variable so that will have a value even if SQL did not find any observations.&amp;nbsp; So the side effect would be that the pre-existing value persists even after this block of code runs.&lt;/LI&gt;&lt;LI&gt;The %LET method does not care whether the variable is local (to the executing macro) or external (global or local to a surrounding macro scope) and so is more flexible. &lt;/LI&gt;&lt;LI&gt;I do not like about overuse of %GLOBAL is that it clutters the global macro space. &lt;/LI&gt;&lt;LI&gt; I write a lot of utility macros and I am careful to make sure to define the inputs and outputs to avoid unintended interactions.&amp;nbsp; Within a macro I&amp;nbsp; will frequently use %LOCAL to define (and initialize to empty) a variable.&lt;/LI&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2011 13:18:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Global-macro-variable/m-p/12253#M1607</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2011-09-23T13:18:24Z</dc:date>
    </item>
    <item>
      <title>Global macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Global-macro-variable/m-p/12254#M1608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks . Tom. Educated it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Sep 2011 03:33:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Global-macro-variable/m-p/12254#M1608</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-09-26T03:33:31Z</dc:date>
    </item>
  </channel>
</rss>

