<?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: Change a Global Variable Dynamically in a Macro in Developers</title>
    <link>https://communities.sas.com/t5/Developers/Change-a-Global-Variable-Dynamically-in-a-Macro/m-p/195134#M4472</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry to sound like a broken record, but the examples you have given above would be far simpler to put lists of options in datasets rather than trying to force macro language to do base language processing. &lt;/P&gt;&lt;P&gt;data list;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; val="A"; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; val="B"; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; val="C"; output;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;/* Use list in base code */&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;proc sql;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; create table WANT as&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select * from HAVE where ID in (select VAL from LIST);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;/* Use list to create where list */&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select VAL into :V_LIST separated by " ";&amp;nbsp; /* Just change if you want commas */&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have (where=(id in (&amp;amp;V_LIST.));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Etc.&amp;nbsp; The above seems far simpler to me that all that %xyz(&amp;amp;&amp;amp;&amp;amp;ABC&amp;amp;&amp;amp;&amp;amp;YYX%something());&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 29 May 2015 08:47:57 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2015-05-29T08:47:57Z</dc:date>
    <item>
      <title>Change a Global Variable Dynamically in a Macro</title>
      <link>https://communities.sas.com/t5/Developers/Change-a-Global-Variable-Dynamically-in-a-Macro/m-p/195126#M4464</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there a way in SAS 9.2 to dynamically change a Global variable within a SAS macro e.g.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%Global testVar;&lt;/P&gt;&lt;P&gt;%macro Test(variableToChange);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let variableToChange = “A”;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;%Test(testVar);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 May 2015 13:54:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Change-a-Global-Variable-Dynamically-in-a-Macro/m-p/195126#M4464</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2015-05-28T13:54:11Z</dc:date>
    </item>
    <item>
      <title>Re: Change a Global Variable Dynamically in a Macro</title>
      <link>https://communities.sas.com/t5/Developers/Change-a-Global-Variable-Dynamically-in-a-Macro/m-p/195127#M4465</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Very close ... need to add an ampersand:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let &amp;amp;variableToChange = "A";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's not clear that you want quotes as part of the new value ... your example will change the variable to a set of three characters where the second character is A and the first and third characters are quotes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, the local symbol table must not contain a macro variable named testVar. If it does, the local version will be changed not the global version.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 May 2015 13:59:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Change-a-Global-Variable-Dynamically-in-a-Macro/m-p/195127#M4465</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-05-28T13:59:16Z</dc:date>
    </item>
    <item>
      <title>Re: Change a Global Variable Dynamically in a Macro</title>
      <link>https://communities.sas.com/t5/Developers/Change-a-Global-Variable-Dynamically-in-a-Macro/m-p/195128#M4466</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there a way for a SAS macro to return a value?&amp;nbsp; I found some documentation that looked like the below.&amp;nbsp; Where the paper left the semi-colon off but it didn’t work for me in SAS 9.2.&lt;/P&gt;&lt;P style="margin-bottom: .0001pt; background: white;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Helvetica, sans-serif;"&gt;%macro Test(variableToChange);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt; background: white;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Helvetica, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let variableToChange = ‘A’;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background: white;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Helvetica, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;variableToChange /*this would be returned??*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background: white;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Helvetica, sans-serif;"&gt;%mend;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 May 2015 14:07:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Change-a-Global-Variable-Dynamically-in-a-Macro/m-p/195128#M4466</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2015-05-28T14:07:00Z</dc:date>
    </item>
    <item>
      <title>Re: Change a Global Variable Dynamically in a Macro</title>
      <link>https://communities.sas.com/t5/Developers/Change-a-Global-Variable-Dynamically-in-a-Macro/m-p/195129#M4467</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This time you need to add two ampersands.&amp;nbsp; The text to be returned should be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;amp;&amp;amp;&amp;amp;variableToChange&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;amp;variableToChange resolves to TextVar.&amp;nbsp; Adding the two ampersands resolves to the value of &amp;amp;TextVar.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 May 2015 14:14:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Change-a-Global-Variable-Dynamically-in-a-Macro/m-p/195129#M4467</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-05-28T14:14:10Z</dc:date>
    </item>
    <item>
      <title>Re: Change a Global Variable Dynamically in a Macro</title>
      <link>https://communities.sas.com/t5/Developers/Change-a-Global-Variable-Dynamically-in-a-Macro/m-p/195130#M4468</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is it good practice to do this however?&amp;nbsp; The term Global means the whole program, to change that within a specific section seems to defeat the purpose.&amp;nbsp; Take an example:&lt;/P&gt;&lt;P&gt;%global pi;&lt;/P&gt;&lt;P&gt;%let pi=3.14;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro print();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc print ...;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let pi=3.141;&lt;/P&gt;&lt;P&gt;%mend print;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%Check_Circle_Measurements();&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;%Print();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;%Check_Circle_Measurements();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;The print changes the calculation later on.&amp;nbsp; Ok, with this you can see that, but if you have several files included, would you not lose confidence in the fact that pi had changed?&amp;nbsp; This is one of the old obfuscation techniques, change something which appears to be one thing into another in a subtle manner so its hard to see.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 May 2015 14:14:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Change-a-Global-Variable-Dynamically-in-a-Macro/m-p/195130#M4468</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-05-28T14:14:56Z</dc:date>
    </item>
    <item>
      <title>Re: Change a Global Variable Dynamically in a Macro</title>
      <link>https://communities.sas.com/t5/Developers/Change-a-Global-Variable-Dynamically-in-a-Macro/m-p/195131#M4469</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 11pt; font-family: Arial, sans-serif; background: white;"&gt;%let &amp;amp;variableToChange = “A”;&lt;/SPAN&gt;&lt;SPAN style="font-size: 11pt; font-family: Arial, sans-serif;"&gt; worked for me on a simple scenario.&amp;nbsp; I tried using the same logic in a more complex macro and found that I’m running into an error on &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11pt; font-family: Arial, sans-serif;"&gt;%let &amp;amp;spacedList = &amp;amp;spacedList.%scan(%superQ(commaList), 1, str(,));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11pt; font-family: Arial, sans-serif;"&gt;Where this works.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11pt; font-family: Arial, sans-serif;"&gt;%let degStudLev = &amp;amp;degStudLev.%scan(%superQ(degStudLevComma), 1, str(,));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11pt; font-family: Arial, sans-serif;"&gt;The full examples are below.&amp;nbsp; I’m thinking that I need to enclose commaList with something.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11pt; font-family: Arial, sans-serif;"&gt;/*outputs degStudLevdegS (Weird Output)*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11pt; font-family: Arial, sans-serif;"&gt;%Macro convertCommaListToSpaced(commaList, spacedList);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11pt; font-family: Arial, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let &amp;amp;spacedList = &amp;amp;spacedList.%scan(%superQ(commaList), 1, str(,));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11pt; font-family: Arial, sans-serif;"&gt;%mend;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11pt; font-family: Arial, sans-serif;"&gt;%macro testmacro3();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11pt; font-family: Arial, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let degStudLevComma = AH,AX,AV,AI;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11pt; font-family: Arial, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let degStudLev= %str();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11pt; font-family: Arial, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %convertCommaListToSpaced(degStudLevComma, degStudLev);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11pt; font-family: Arial, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %put &amp;amp;degStudLev;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11pt; font-family: Arial, sans-serif;"&gt;%mend;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11pt; font-family: Arial, sans-serif;"&gt;%testmacro3;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11pt; font-family: Arial, sans-serif;"&gt;/*outputs AH (Good Output)*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11pt; font-family: Arial, sans-serif;"&gt;%Macro convertCommaListToSpaced(commaList, spacedList);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11pt; font-family: Arial, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let degStudLevComma = AH,AX,AV,AI;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11pt; font-family: Arial, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let degStudLev= %str();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11pt; font-family: Arial, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let degStudLev = &amp;amp;degStudLev.%scan(%superQ(degStudLevComma), 1, str(,));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11pt; font-family: Arial, sans-serif;"&gt;%mend;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11pt; font-family: Arial, sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11pt; font-family: Arial, sans-serif;"&gt;%macro testmacro3();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11pt; font-family: Arial, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %convertCommaListToSpaced(degStudLevComma, degStudLev);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11pt; font-family: Arial, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %put &amp;amp;degStudLev;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11pt; font-family: Arial, sans-serif;"&gt;%mend;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11pt; font-family: Arial, sans-serif;"&gt;%testmacro3;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 May 2015 17:21:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Change-a-Global-Variable-Dynamically-in-a-Macro/m-p/195131#M4469</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2015-05-28T17:21:24Z</dc:date>
    </item>
    <item>
      <title>Re: Change a Global Variable Dynamically in a Macro</title>
      <link>https://communities.sas.com/t5/Developers/Change-a-Global-Variable-Dynamically-in-a-Macro/m-p/195132#M4470</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Arial',sans-serif; color: black; background: white;"&gt;A little simpler example of the problem.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Arial',sans-serif; color: black; background: white;"&gt;This produces: degStuLevComma.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Arial',sans-serif;"&gt;/*outputs&lt;SPAN class="apple-converted-space"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000; background: white; font-size: 14.6666669845581px; background-color: #ffffff; font-family: Arial, sans-serif;"&gt;degStuLevComma&lt;/SPAN&gt;*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Arial',sans-serif;"&gt;%Macro convertCommaListToSpaced(commaList, spacedList);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Arial',sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let test = A;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Arial',sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %put &amp;amp;commaList;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Arial',sans-serif;"&gt;%mend;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Arial',sans-serif;"&gt;%macro testmacro3();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Arial',sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let degStudLevComma = AH,AX,AV,AI;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Arial',sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let degStudLev= %str();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Arial',sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %convertCommaListToSpaced(degStudLevComma, degStudLev);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Arial',sans-serif;"&gt;%mend;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Arial',sans-serif;"&gt;%testmacro3;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 May 2015 17:33:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Change-a-Global-Variable-Dynamically-in-a-Macro/m-p/195132#M4470</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2015-05-28T17:33:58Z</dc:date>
    </item>
    <item>
      <title>Re: Change a Global Variable Dynamically in a Macro</title>
      <link>https://communities.sas.com/t5/Developers/Change-a-Global-Variable-Dynamically-in-a-Macro/m-p/195133#M4471</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 11pt; font-family: Arial, sans-serif;"&gt;I found I can use this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11pt; font-family: Arial, sans-serif;"&gt;%let degStudLev = %convertCommaListToSpaced(commaList =%str(%quote(&amp;amp;degStudLevComma)), spacedList =&amp;amp;degStudLev);&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11pt; font-family: Arial, sans-serif;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11pt; font-family: Arial, sans-serif;"&gt;Still my result is not equivalent to running this without the macro.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 May 2015 17:52:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Change-a-Global-Variable-Dynamically-in-a-Macro/m-p/195133#M4471</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2015-05-28T17:52:13Z</dc:date>
    </item>
    <item>
      <title>Re: Change a Global Variable Dynamically in a Macro</title>
      <link>https://communities.sas.com/t5/Developers/Change-a-Global-Variable-Dynamically-in-a-Macro/m-p/195134#M4472</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry to sound like a broken record, but the examples you have given above would be far simpler to put lists of options in datasets rather than trying to force macro language to do base language processing. &lt;/P&gt;&lt;P&gt;data list;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; val="A"; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; val="B"; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; val="C"; output;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;/* Use list in base code */&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;proc sql;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; create table WANT as&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select * from HAVE where ID in (select VAL from LIST);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;/* Use list to create where list */&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select VAL into :V_LIST separated by " ";&amp;nbsp; /* Just change if you want commas */&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have (where=(id in (&amp;amp;V_LIST.));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Etc.&amp;nbsp; The above seems far simpler to me that all that %xyz(&amp;amp;&amp;amp;&amp;amp;ABC&amp;amp;&amp;amp;&amp;amp;YYX%something());&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 May 2015 08:47:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Change-a-Global-Variable-Dynamically-in-a-Macro/m-p/195134#M4472</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-05-29T08:47:57Z</dc:date>
    </item>
    <item>
      <title>Re: Change a Global Variable Dynamically in a Macro</title>
      <link>https://communities.sas.com/t5/Developers/Change-a-Global-Variable-Dynamically-in-a-Macro/m-p/195135#M4473</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial',sans-serif; color: black; background: white;"&gt;RW9,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial',sans-serif; color: black; background: white;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial',sans-serif; color: black; background: white;"&gt;The input format is A,B,C. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial',sans-serif; color: black; background: white;"&gt;Step 1 requires format A B C&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial',sans-serif; color: black; background: white;"&gt;Step 2 requires ‘A’, ‘B’, ‘C’&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial',sans-serif; color: black; background: white;"&gt;I need the macro to convert the input format to at least step 1.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial',sans-serif; color: black; background: white;"&gt;I also need to run this logic on 20 different inputs at different parts of the stored process.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 May 2015 12:32:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Change-a-Global-Variable-Dynamically-in-a-Macro/m-p/195135#M4473</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2015-05-29T12:32:27Z</dc:date>
    </item>
    <item>
      <title>Re: Change a Global Variable Dynamically in a Macro</title>
      <link>https://communities.sas.com/t5/Developers/Change-a-Global-Variable-Dynamically-in-a-Macro/m-p/195136#M4474</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure what you mean by "input" as don't use stored processes, but:&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set input;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call symput('step1',tranwrd(input,","," "));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call symput('step2',"'"||tranwrd(input,",","','")||"'");&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Should do it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 May 2015 12:50:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Change-a-Global-Variable-Dynamically-in-a-Macro/m-p/195136#M4474</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-05-29T12:50:11Z</dc:date>
    </item>
  </channel>
</rss>

