<?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 make the macro variables created in %do loop global in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/make-the-macro-variables-created-in-do-loop-global/m-p/491034#M128662</link>
    <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My goal here is to put the analysis results into macro variables in each loop (with a loop ID of course) for future use. The code is like this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro put_true_parent; 
		proc sql;
			select D12, D13, D14, D23, D24, D34, R12, R13, R14, R23, R24, R34
				into :D12_&amp;amp;CI._1 - :D12_&amp;amp;CI._2, :D13_&amp;amp;CI._1 - :D13_&amp;amp;CI._2, :D14_&amp;amp;CI._1 - :D14_&amp;amp;CI._2,
					:D23_&amp;amp;CI._1 - :D23_&amp;amp;CI._2, :D24_&amp;amp;CI._1 - :D24_&amp;amp;CI._2, :D34_&amp;amp;CI._1 - :D34_&amp;amp;CI._2, 
					:R12_&amp;amp;CI._1 - :R12_&amp;amp;CI._2, :R13_&amp;amp;CI._1 - :R13_&amp;amp;CI._2, :R14_&amp;amp;CI._1 - :R14_&amp;amp;CI._2,
					:R23_&amp;amp;CI._1 - :R23_&amp;amp;CI._2, :R24_&amp;amp;CI._1 - :R24_&amp;amp;CI._2, :R34_&amp;amp;CI._1 - :R34_&amp;amp;CI._2
				from GDmeasure; 
		quit; 
		%let D12_1_CI&amp;amp;nCI=&amp;amp;&amp;amp;D12_&amp;amp;CI._1; %let D12_2_CI&amp;amp;nCI=&amp;amp;&amp;amp;D12_&amp;amp;CI._2; %let D13_1_CI&amp;amp;nCI=&amp;amp;&amp;amp;D13_&amp;amp;CI._1; %let D13_2_CI&amp;amp;nCI=&amp;amp;&amp;amp;D13_&amp;amp;CI._2;
		%let D14_1_CI&amp;amp;nCI=&amp;amp;&amp;amp;D14_&amp;amp;CI._1; %let D14_2_CI&amp;amp;nCI=&amp;amp;&amp;amp;D14_&amp;amp;CI._2; %let D23_1_CI&amp;amp;nCI=&amp;amp;&amp;amp;D23_&amp;amp;CI._1; %let D23_2_CI&amp;amp;nCI=&amp;amp;&amp;amp;D23_&amp;amp;CI._2;
		%let D24_1_CI&amp;amp;nCI=&amp;amp;&amp;amp;D24_&amp;amp;CI._1; %let D24_2_CI&amp;amp;nCI=&amp;amp;&amp;amp;D24_&amp;amp;CI._2; %let D34_1_CI&amp;amp;nCI=&amp;amp;&amp;amp;D34_&amp;amp;CI._1; %let D34_2_CI&amp;amp;nCI=&amp;amp;&amp;amp;D34_&amp;amp;CI._2;  
		%let R12_1_CI&amp;amp;nCI=&amp;amp;&amp;amp;R12_&amp;amp;CI._1; %let R12_2_CI&amp;amp;nCI=&amp;amp;&amp;amp;R12_&amp;amp;CI._2; %let R13_1_CI&amp;amp;nCI=&amp;amp;&amp;amp;R13_&amp;amp;CI._1; %let R13_2_CI&amp;amp;nCI=&amp;amp;&amp;amp;R13_&amp;amp;CI._2;
		%let R14_1_CI&amp;amp;nCI=&amp;amp;&amp;amp;R14_&amp;amp;CI._1; %let R14_2_CI&amp;amp;nCI=&amp;amp;&amp;amp;R14_&amp;amp;CI._2; %let R23_1_CI&amp;amp;nCI=&amp;amp;&amp;amp;R23_&amp;amp;CI._1; %let R23_2_CI&amp;amp;nCI=&amp;amp;&amp;amp;R23_&amp;amp;CI._2;
		%let R24_1_CI&amp;amp;nCI=&amp;amp;&amp;amp;R24_&amp;amp;CI._1; %let R24_2_CI&amp;amp;nCI=&amp;amp;&amp;amp;R24_&amp;amp;CI._2; %let R34_1_CI&amp;amp;nCI=&amp;amp;&amp;amp;R34_&amp;amp;CI._1; %let R34_2_CI&amp;amp;nCI=&amp;amp;&amp;amp;R34_&amp;amp;CI._2;  
		%global D12_1_CI&amp;amp;nCI D12_2_CI&amp;amp;nCI D13_1_CI&amp;amp;nCI D13_2_CI&amp;amp;nCI D14_1_CI&amp;amp;nCI D14_2_CI&amp;amp;nCI	D23_1_CI&amp;amp;nCI D23_2_CI&amp;amp;nCI D24_1_CI&amp;amp;nCI D24_2_CI&amp;amp;nCI D34_1_CI&amp;amp;nCI D34_2_CI&amp;amp;nCI 
			R12_1_CI&amp;amp;nCI R12_2_CI&amp;amp;nCI R13_1_CI&amp;amp;nCI R13_2_CI&amp;amp;nCI R14_1_CI&amp;amp;nCI R14_2_CI&amp;amp;nCI	R23_1_CI&amp;amp;nCI R23_2_CI&amp;amp;nCI R24_1_CI&amp;amp;nCI R24_2_CI&amp;amp;nCI R34_1_CI&amp;amp;nCI R34_2_CI&amp;amp;nCI;
%mend put_true_parent; 

&lt;BR /&gt;
%macro effectsize_parent;
%do ncistart = &amp;amp;start %to &amp;amp;end %by &amp;amp;by;
	%let nci = %eval(%eval(&amp;amp;ncistart) + %eval(&amp;amp;by)-1);
	%do CI = &amp;amp;ncistart %to &amp;amp;nci;
		proc surveyselect data=logireg method=srs n=&amp;amp;size seed=&amp;amp;ci.123 out=Parent_sp_&amp;amp;CI;
		run;
		%GDmeasure; /*to obtain the dominance statistics to be analyzed*/
		%put_true_parent;
	%end;
	proc datasets lib=work memtype=data nolist; delete a: cov: ful: gd: m: parent: sp: sub: ; quit; 
%end; 
%mend effectsize_parent;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;The second macro does some analysis and the first macro intends to put the results value from the analysis into macro variables for future use. I believe this should not be a difficult job but generate error message like this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: Attempt to %GLOBAL a name (D12_1_CI1) which exists in a local environment.&lt;BR /&gt;ERROR: Attempt to %GLOBAL a name (D12_2_CI1) which exists in a local environment.&lt;BR /&gt;ERROR: Attempt to %GLOBAL a name (D13_1_CI1) which exists in a local environment.&lt;BR /&gt;ERROR: Attempt to %GLOBAL a name (D13_2_CI1) which exists in a local environment.&lt;BR /&gt;ERROR: Attempt to %GLOBAL a name (D14_1_CI1) which exists in a local environment.&lt;BR /&gt;ERROR: Attempt to %GLOBAL a name (D14_2_CI1) which exists in a local environment.&lt;BR /&gt;ERROR: Attempt to %GLOBAL a name (D23_1_CI1) which exists in a local environment.&lt;BR /&gt;ERROR: Attempt to %GLOBAL a name (D23_2_CI1) which exists in a local environment.&lt;BR /&gt;ERROR: Attempt to %GLOBAL a name (D24_1_CI1) which exists in a local environment.&lt;BR /&gt;ERROR: Attempt to %GLOBAL a name (D24_2_CI1) which exists in a local environment.&lt;BR /&gt;ERROR: Attempt to %GLOBAL a name (D34_1_CI1) which exists in a local environment.&lt;BR /&gt;ERROR: Attempt to %GLOBAL a name (D34_2_CI1) which exists in a local environment.&lt;BR /&gt;ERROR: Attempt to %GLOBAL a name (R12_1_CI1) which exists in a local environment.&lt;BR /&gt;ERROR: Attempt to %GLOBAL a name (R12_2_CI1) which exists in a local environment.&lt;BR /&gt;ERROR: Attempt to %GLOBAL a name (R13_1_CI1) which exists in a local environment.&lt;BR /&gt;ERROR: Attempt to %GLOBAL a name (R13_2_CI1) which exists in a local environment.&lt;BR /&gt;ERROR: Attempt to %GLOBAL a name (R14_1_CI1) which exists in a local environment.&lt;BR /&gt;ERROR: Attempt to %GLOBAL a name (R14_2_CI1) which exists in a local environment.&lt;BR /&gt;ERROR: Attempt to %GLOBAL a name (R23_1_CI1) which exists in a local environment.&lt;BR /&gt;... ...&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Macro variables in the error messages are what I want to make global. There is going to be 1000 sets (24 in each set) of them. I need to identify each set with a "CI" (a % do loop variable)&amp;nbsp;because they are to be referred by CI.&amp;nbsp;&amp;nbsp; Anybody knows how to how to make it possible?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 29 Aug 2018 23:44:31 GMT</pubDate>
    <dc:creator>wang267</dc:creator>
    <dc:date>2018-08-29T23:44:31Z</dc:date>
    <item>
      <title>make the macro variables created in %do loop global</title>
      <link>https://communities.sas.com/t5/SAS-Programming/make-the-macro-variables-created-in-do-loop-global/m-p/491034#M128662</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My goal here is to put the analysis results into macro variables in each loop (with a loop ID of course) for future use. The code is like this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro put_true_parent; 
		proc sql;
			select D12, D13, D14, D23, D24, D34, R12, R13, R14, R23, R24, R34
				into :D12_&amp;amp;CI._1 - :D12_&amp;amp;CI._2, :D13_&amp;amp;CI._1 - :D13_&amp;amp;CI._2, :D14_&amp;amp;CI._1 - :D14_&amp;amp;CI._2,
					:D23_&amp;amp;CI._1 - :D23_&amp;amp;CI._2, :D24_&amp;amp;CI._1 - :D24_&amp;amp;CI._2, :D34_&amp;amp;CI._1 - :D34_&amp;amp;CI._2, 
					:R12_&amp;amp;CI._1 - :R12_&amp;amp;CI._2, :R13_&amp;amp;CI._1 - :R13_&amp;amp;CI._2, :R14_&amp;amp;CI._1 - :R14_&amp;amp;CI._2,
					:R23_&amp;amp;CI._1 - :R23_&amp;amp;CI._2, :R24_&amp;amp;CI._1 - :R24_&amp;amp;CI._2, :R34_&amp;amp;CI._1 - :R34_&amp;amp;CI._2
				from GDmeasure; 
		quit; 
		%let D12_1_CI&amp;amp;nCI=&amp;amp;&amp;amp;D12_&amp;amp;CI._1; %let D12_2_CI&amp;amp;nCI=&amp;amp;&amp;amp;D12_&amp;amp;CI._2; %let D13_1_CI&amp;amp;nCI=&amp;amp;&amp;amp;D13_&amp;amp;CI._1; %let D13_2_CI&amp;amp;nCI=&amp;amp;&amp;amp;D13_&amp;amp;CI._2;
		%let D14_1_CI&amp;amp;nCI=&amp;amp;&amp;amp;D14_&amp;amp;CI._1; %let D14_2_CI&amp;amp;nCI=&amp;amp;&amp;amp;D14_&amp;amp;CI._2; %let D23_1_CI&amp;amp;nCI=&amp;amp;&amp;amp;D23_&amp;amp;CI._1; %let D23_2_CI&amp;amp;nCI=&amp;amp;&amp;amp;D23_&amp;amp;CI._2;
		%let D24_1_CI&amp;amp;nCI=&amp;amp;&amp;amp;D24_&amp;amp;CI._1; %let D24_2_CI&amp;amp;nCI=&amp;amp;&amp;amp;D24_&amp;amp;CI._2; %let D34_1_CI&amp;amp;nCI=&amp;amp;&amp;amp;D34_&amp;amp;CI._1; %let D34_2_CI&amp;amp;nCI=&amp;amp;&amp;amp;D34_&amp;amp;CI._2;  
		%let R12_1_CI&amp;amp;nCI=&amp;amp;&amp;amp;R12_&amp;amp;CI._1; %let R12_2_CI&amp;amp;nCI=&amp;amp;&amp;amp;R12_&amp;amp;CI._2; %let R13_1_CI&amp;amp;nCI=&amp;amp;&amp;amp;R13_&amp;amp;CI._1; %let R13_2_CI&amp;amp;nCI=&amp;amp;&amp;amp;R13_&amp;amp;CI._2;
		%let R14_1_CI&amp;amp;nCI=&amp;amp;&amp;amp;R14_&amp;amp;CI._1; %let R14_2_CI&amp;amp;nCI=&amp;amp;&amp;amp;R14_&amp;amp;CI._2; %let R23_1_CI&amp;amp;nCI=&amp;amp;&amp;amp;R23_&amp;amp;CI._1; %let R23_2_CI&amp;amp;nCI=&amp;amp;&amp;amp;R23_&amp;amp;CI._2;
		%let R24_1_CI&amp;amp;nCI=&amp;amp;&amp;amp;R24_&amp;amp;CI._1; %let R24_2_CI&amp;amp;nCI=&amp;amp;&amp;amp;R24_&amp;amp;CI._2; %let R34_1_CI&amp;amp;nCI=&amp;amp;&amp;amp;R34_&amp;amp;CI._1; %let R34_2_CI&amp;amp;nCI=&amp;amp;&amp;amp;R34_&amp;amp;CI._2;  
		%global D12_1_CI&amp;amp;nCI D12_2_CI&amp;amp;nCI D13_1_CI&amp;amp;nCI D13_2_CI&amp;amp;nCI D14_1_CI&amp;amp;nCI D14_2_CI&amp;amp;nCI	D23_1_CI&amp;amp;nCI D23_2_CI&amp;amp;nCI D24_1_CI&amp;amp;nCI D24_2_CI&amp;amp;nCI D34_1_CI&amp;amp;nCI D34_2_CI&amp;amp;nCI 
			R12_1_CI&amp;amp;nCI R12_2_CI&amp;amp;nCI R13_1_CI&amp;amp;nCI R13_2_CI&amp;amp;nCI R14_1_CI&amp;amp;nCI R14_2_CI&amp;amp;nCI	R23_1_CI&amp;amp;nCI R23_2_CI&amp;amp;nCI R24_1_CI&amp;amp;nCI R24_2_CI&amp;amp;nCI R34_1_CI&amp;amp;nCI R34_2_CI&amp;amp;nCI;
%mend put_true_parent; 

&lt;BR /&gt;
%macro effectsize_parent;
%do ncistart = &amp;amp;start %to &amp;amp;end %by &amp;amp;by;
	%let nci = %eval(%eval(&amp;amp;ncistart) + %eval(&amp;amp;by)-1);
	%do CI = &amp;amp;ncistart %to &amp;amp;nci;
		proc surveyselect data=logireg method=srs n=&amp;amp;size seed=&amp;amp;ci.123 out=Parent_sp_&amp;amp;CI;
		run;
		%GDmeasure; /*to obtain the dominance statistics to be analyzed*/
		%put_true_parent;
	%end;
	proc datasets lib=work memtype=data nolist; delete a: cov: ful: gd: m: parent: sp: sub: ; quit; 
%end; 
%mend effectsize_parent;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;The second macro does some analysis and the first macro intends to put the results value from the analysis into macro variables for future use. I believe this should not be a difficult job but generate error message like this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: Attempt to %GLOBAL a name (D12_1_CI1) which exists in a local environment.&lt;BR /&gt;ERROR: Attempt to %GLOBAL a name (D12_2_CI1) which exists in a local environment.&lt;BR /&gt;ERROR: Attempt to %GLOBAL a name (D13_1_CI1) which exists in a local environment.&lt;BR /&gt;ERROR: Attempt to %GLOBAL a name (D13_2_CI1) which exists in a local environment.&lt;BR /&gt;ERROR: Attempt to %GLOBAL a name (D14_1_CI1) which exists in a local environment.&lt;BR /&gt;ERROR: Attempt to %GLOBAL a name (D14_2_CI1) which exists in a local environment.&lt;BR /&gt;ERROR: Attempt to %GLOBAL a name (D23_1_CI1) which exists in a local environment.&lt;BR /&gt;ERROR: Attempt to %GLOBAL a name (D23_2_CI1) which exists in a local environment.&lt;BR /&gt;ERROR: Attempt to %GLOBAL a name (D24_1_CI1) which exists in a local environment.&lt;BR /&gt;ERROR: Attempt to %GLOBAL a name (D24_2_CI1) which exists in a local environment.&lt;BR /&gt;ERROR: Attempt to %GLOBAL a name (D34_1_CI1) which exists in a local environment.&lt;BR /&gt;ERROR: Attempt to %GLOBAL a name (D34_2_CI1) which exists in a local environment.&lt;BR /&gt;ERROR: Attempt to %GLOBAL a name (R12_1_CI1) which exists in a local environment.&lt;BR /&gt;ERROR: Attempt to %GLOBAL a name (R12_2_CI1) which exists in a local environment.&lt;BR /&gt;ERROR: Attempt to %GLOBAL a name (R13_1_CI1) which exists in a local environment.&lt;BR /&gt;ERROR: Attempt to %GLOBAL a name (R13_2_CI1) which exists in a local environment.&lt;BR /&gt;ERROR: Attempt to %GLOBAL a name (R14_1_CI1) which exists in a local environment.&lt;BR /&gt;ERROR: Attempt to %GLOBAL a name (R14_2_CI1) which exists in a local environment.&lt;BR /&gt;ERROR: Attempt to %GLOBAL a name (R23_1_CI1) which exists in a local environment.&lt;BR /&gt;... ...&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Macro variables in the error messages are what I want to make global. There is going to be 1000 sets (24 in each set) of them. I need to identify each set with a "CI" (a % do loop variable)&amp;nbsp;because they are to be referred by CI.&amp;nbsp;&amp;nbsp; Anybody knows how to how to make it possible?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Aug 2018 23:44:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/make-the-macro-variables-created-in-do-loop-global/m-p/491034#M128662</guid>
      <dc:creator>wang267</dc:creator>
      <dc:date>2018-08-29T23:44:31Z</dc:date>
    </item>
    <item>
      <title>Re: make the macro variables created in %do loop global</title>
      <link>https://communities.sas.com/t5/SAS-Programming/make-the-macro-variables-created-in-do-loop-global/m-p/491036#M128664</link>
      <description>&lt;P&gt;Use a data step and CALL SYMPUTX instead to create the macro variables. One of the options within CALL SYMPUTX is to specify local or global.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;OR&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Rather than do this type of coding, I would highly recommend&amp;nbsp;using a data step and calling&amp;nbsp;the macro from the data step&amp;nbsp;with more parameters, if needed, using&amp;nbsp;CALL EXECUTE or DOSUBL.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's a lot cleaner and easier to debug, and it seems like the data is already in a data set to drive it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wrote a basic tutorial on converting working code to a macro&amp;nbsp;last week here:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/statgeek/SAS-Tutorials/blob/master/Turning%20a%20program%20into%20a%20macro.md" target="_blank"&gt;https://github.com/statgeek/SAS-Tutorials/blob/master/Turning%20a%20program%20into%20a%20macro.md&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The main reason I recommend this approach is how easy it is to implement and debug compared to macro loops.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Aug 2018 23:52:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/make-the-macro-variables-created-in-do-loop-global/m-p/491036#M128664</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-08-29T23:52:25Z</dc:date>
    </item>
    <item>
      <title>Re: make the macro variables created in %do loop global</title>
      <link>https://communities.sas.com/t5/SAS-Programming/make-the-macro-variables-created-in-do-loop-global/m-p/491047#M128672</link>
      <description>&lt;P&gt;Agree with&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;, this looks like there's probably a better approach to your problem.&amp;nbsp; That's a LOT of macro variables you're making, and usually there are better ways to store data than macro variables.&amp;nbsp; You've got a lovely dataset work.GDMeasure.&amp;nbsp; SAS is really good at storing data in datasets, and letting you manipulate that data.&amp;nbsp; Usually it's not a good idea to just dump a bunch of data into macro variables.&amp;nbsp; Since macro variables are text, you lose precision. And generally they're a hassle to work with.&amp;nbsp; (And I say that even though I'm a big fan of the macro language!)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That said, I would think you could move your long %GLOBAL statement to the top of the macro definition.&amp;nbsp; As is, the PROC SQL creates them as local macro variables.&amp;nbsp; As the error message says, you can't change a local macro variable into a global macro variable.&amp;nbsp; For this reason, most people put a %GLOBAL or %LOCAL statement at the top of their macro.&amp;nbsp; This will create all of the listed macro variables, in the specified scope.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Aug 2018 01:43:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/make-the-macro-variables-created-in-do-loop-global/m-p/491047#M128672</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2018-08-30T01:43:36Z</dc:date>
    </item>
    <item>
      <title>Re: make the macro variables created in %do loop global</title>
      <link>https://communities.sas.com/t5/SAS-Programming/make-the-macro-variables-created-in-do-loop-global/m-p/491070#M128683</link>
      <description>&lt;P&gt;The error message is clearly showing what is wrong with your code.&amp;nbsp; Your logic is&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Assign values to to macro variables.&lt;/LI&gt;
&lt;LI&gt;Try to create a global macro variable with the same name&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Try changing the logic to&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Create global macro variables.&lt;/LI&gt;
&lt;LI&gt;Assign values to the global macro variables.&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Thu, 30 Aug 2018 04:11:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/make-the-macro-variables-created-in-do-loop-global/m-p/491070#M128683</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-08-30T04:11:45Z</dc:date>
    </item>
    <item>
      <title>Re: make the macro variables created in %do loop global</title>
      <link>https://communities.sas.com/t5/SAS-Programming/make-the-macro-variables-created-in-do-loop-global/m-p/491367#M128839</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19879"&gt;@Quentin&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I put the %global before PROC SQL and it works. I was thinking the looping variable &amp;amp;CI was the problem, but it was not.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you all!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Aug 2018 18:15:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/make-the-macro-variables-created-in-do-loop-global/m-p/491367#M128839</guid>
      <dc:creator>wang267</dc:creator>
      <dc:date>2018-08-30T18:15:00Z</dc:date>
    </item>
  </channel>
</rss>

