<?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: Automating and updating %LET macro statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Automating-and-updating-LET-macro-statement/m-p/541472#M149494</link>
    <description>&lt;P&gt;On the one hand, there is nothing "automatic" about it.&amp;nbsp; SAS will never know what the user entered, or that yout want it appended to AllCodes unless you write a program.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;On the other hand, the programming is easy:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let AllCodes = &amp;amp;AllCodes &amp;amp;Codes3;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As long as &amp;amp;Codes3 exists, the program works.&amp;nbsp; If the user entered nothing at all, but &amp;amp;Codes3 still exists with a null value, the program still works.&lt;/P&gt;</description>
    <pubDate>Fri, 08 Mar 2019 17:06:01 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2019-03-08T17:06:01Z</dc:date>
    <item>
      <title>Automating and updating %LET macro statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automating-and-updating-LET-macro-statement/m-p/541471#M149493</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to automate something here:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a set of codes that have been defined like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let Codes1 = "10000" "10001"&amp;nbsp;"10002"&amp;nbsp;"10003"&lt;/P&gt;&lt;P&gt;%let Codes2 = "20000" "20001"&amp;nbsp;"20002"&amp;nbsp;"20003"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let allCodes = &amp;amp;Codes1. &amp;amp;Codes2. ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to create code that automatically updates this macro variable allCodes so that if the user adds more types of codes. For ex, if a user wants to add Code3 like:&lt;/P&gt;&lt;P&gt;%let Codes3= "abc" "xyz"&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then how to update allCodes automatically such that it would now be defined as :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let allCodes = &amp;amp;Codes1. &amp;amp;Codes2. &amp;amp;Codes3.;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think this would be some combination of using sysfunc and concatenating the variables.&lt;/P&gt;&lt;P&gt;Any ideas would be highly appreciated...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tina&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2019 16:57:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automating-and-updating-LET-macro-statement/m-p/541471#M149493</guid>
      <dc:creator>rosegarden81</dc:creator>
      <dc:date>2019-03-08T16:57:58Z</dc:date>
    </item>
    <item>
      <title>Re: Automating and updating %LET macro statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automating-and-updating-LET-macro-statement/m-p/541472#M149494</link>
      <description>&lt;P&gt;On the one hand, there is nothing "automatic" about it.&amp;nbsp; SAS will never know what the user entered, or that yout want it appended to AllCodes unless you write a program.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;On the other hand, the programming is easy:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let AllCodes = &amp;amp;AllCodes &amp;amp;Codes3;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As long as &amp;amp;Codes3 exists, the program works.&amp;nbsp; If the user entered nothing at all, but &amp;amp;Codes3 still exists with a null value, the program still works.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2019 17:06:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automating-and-updating-LET-macro-statement/m-p/541472#M149494</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-03-08T17:06:01Z</dc:date>
    </item>
    <item>
      <title>Re: Automating and updating %LET macro statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automating-and-updating-LET-macro-statement/m-p/541581#M149546</link>
      <description>&lt;P&gt;I really appreciate your help! I thought this worked in the beginning but for some reason, it is not working anymore...not sure why..&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2019 20:28:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automating-and-updating-LET-macro-statement/m-p/541581#M149546</guid>
      <dc:creator>rosegarden81</dc:creator>
      <dc:date>2019-03-08T20:28:13Z</dc:date>
    </item>
    <item>
      <title>Re: Automating and updating %LET macro statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automating-and-updating-LET-macro-statement/m-p/541590#M149547</link>
      <description>&lt;P&gt;You might need to elaborate ... start with these options turned on:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;options mprint symbolgen;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then show the log from the code that doesn't work.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2019 20:42:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automating-and-updating-LET-macro-statement/m-p/541590#M149547</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-03-08T20:42:16Z</dc:date>
    </item>
    <item>
      <title>Re: Automating and updating %LET macro statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automating-and-updating-LET-macro-statement/m-p/541600#M149553</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So now it is working again after I restarted SAS and used different values for Codes1, Codes2 (for testing)!..I have attached the screenshot but yes, it now works. I think I need a break for some time..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Apologies for the confusion caused!..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tina&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="sc.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/27795i6BCD55C591EEBB49/image-size/large?v=v2&amp;amp;px=999" role="button" title="sc.PNG" alt="sc.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2019 20:51:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automating-and-updating-LET-macro-statement/m-p/541600#M149553</guid>
      <dc:creator>rosegarden81</dc:creator>
      <dc:date>2019-03-08T20:51:12Z</dc:date>
    </item>
    <item>
      <title>Re: Automating and updating %LET macro statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automating-and-updating-LET-macro-statement/m-p/541601#M149554</link>
      <description>&lt;P&gt;Sometimes, Friday can't come soon enough.&amp;nbsp; Good luck.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2019 20:54:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automating-and-updating-LET-macro-statement/m-p/541601#M149554</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-03-08T20:54:08Z</dc:date>
    </item>
    <item>
      <title>Re: Automating and updating %LET macro statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automating-and-updating-LET-macro-statement/m-p/541605#M149556</link>
      <description>&lt;P&gt;Actually, this is what I was referring to. When I run the same SAS as before (without repoening SAS), it is showing a different outcome..Please refer to the screenshot of the SAS log..Any ideas or tips how to avoid this kind of output would be greatly appreciated!..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sc2.JPG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/27796i4DBFF3021022CB5A/image-size/large?v=v2&amp;amp;px=999" role="button" title="sc2.JPG" alt="sc2.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2019 20:58:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automating-and-updating-LET-macro-statement/m-p/541605#M149556</guid>
      <dc:creator>rosegarden81</dc:creator>
      <dc:date>2019-03-08T20:58:41Z</dc:date>
    </item>
    <item>
      <title>Re: Automating and updating %LET macro statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automating-and-updating-LET-macro-statement/m-p/541613#M149561</link>
      <description>&lt;P&gt;My tired eyes don't notice anything unusual.&amp;nbsp; Perhaps for clarity in reading the results, change the %PUT statement:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%put **** &amp;amp;AllCodes ****;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2019 21:10:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automating-and-updating-LET-macro-statement/m-p/541613#M149561</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-03-08T21:10:10Z</dc:date>
    </item>
    <item>
      <title>Re: Automating and updating %LET macro statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automating-and-updating-LET-macro-statement/m-p/541617#M149563</link>
      <description>&lt;P&gt;Made the change you suggested as seen in this screenshot. Previously, it was taking &amp;amp;Codes1, &amp;amp;Codes2, &amp;amp;Codes3 and &amp;amp;Codes4 but after rerunning the same code, it is putting just &amp;amp;Codes1 and &amp;amp;Codes4 so now it is resolving to just "a" "b" "30000" "40000"..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Previously it was correctly resolving to "a" "b" "c" "d" "e" "10000" "20000" "30000" "40000"..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The same exact code when run once again gives different results...May be this is just s software bug..&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;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sc2.JPG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/27797iF856E702C5C30DAD/image-size/large?v=v2&amp;amp;px=999" role="button" title="sc2.JPG" alt="sc2.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2019 21:15:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automating-and-updating-LET-macro-statement/m-p/541617#M149563</guid>
      <dc:creator>rosegarden81</dc:creator>
      <dc:date>2019-03-08T21:15:24Z</dc:date>
    </item>
  </channel>
</rss>

