<?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: how the do loop work with %let in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/how-the-do-loop-work-with-let/m-p/201381#M50266</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It works with the sample code. If your actual code is different then may be you post it (especially the section where you create &amp;amp;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;month_nm&amp;lt;n&amp;gt;). Post the error log (using options mprint) as well because this will be more helpful to us than just you writing "it's not working".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let month_nm1='Jan 2014$';&lt;/P&gt;&lt;P&gt;%let month_nm2='Feb 2014$';&lt;/P&gt;&lt;P&gt;%let mon_tot=2;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro month;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %do i=1 %to &amp;amp;mon_tot %by 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %global mname&amp;amp;i;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let mname&amp;amp;i=%sysfunc(compress(&amp;amp;&amp;amp;month_nm&amp;amp;i,%str($%')));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %put mname&amp;amp;i: &amp;amp;&amp;amp;mname&amp;amp;i;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %end;&lt;/P&gt;&lt;P&gt;%mend month;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%month;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%put mname1: &amp;amp;mname1;&lt;/P&gt;&lt;P&gt;%put mname2: &amp;amp;mname2;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 14 Mar 2015 08:37:38 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2015-03-14T08:37:38Z</dc:date>
    <item>
      <title>how the do loop work with %let</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-the-do-loop-work-with-let/m-p/201378#M50263</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin: 0 0 6px; color: #141823; font-family: Helvetica, Arial, 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 14px; background-color: #ffffff;"&gt;Good day all. &lt;BR /&gt;i have 12macro variables. they are in the format.&lt;BR /&gt;&amp;amp;month_nm1='Jan 2014$' to&lt;BR /&gt;&amp;amp;month_nm12='Dec 2014$'&lt;BR /&gt;now i want the out put like&lt;SPAN class="text_exposed_show"&gt;&lt;BR /&gt;&amp;amp;mname1=Jan 2014&lt;BR /&gt;&amp;amp;mname12=Dec 2014.&lt;BR /&gt;and here &amp;amp;mon_tot value is 12.&lt;BR /&gt;SO i write do loop is it right or not.&lt;BR /&gt;in log its showing some error. and not executing the condition.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0 0 6px;"&gt;%macro month;&lt;BR /&gt;%do i=1 %to &amp;amp;mon_tot %by 1; &lt;BR /&gt;%let mname&amp;amp;i=%sysfunc(compress(&amp;amp;&amp;amp;month_nm&amp;amp;i,'$', 'p'));&lt;BR /&gt;%end;&lt;BR /&gt;%mend month;&lt;BR /&gt;%month;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 14 Mar 2015 07:50:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-the-do-loop-work-with-let/m-p/201378#M50263</guid>
      <dc:creator>Ravikumarkummari</dc:creator>
      <dc:date>2015-03-14T07:50:08Z</dc:date>
    </item>
    <item>
      <title>Re: how the do loop work with %let</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-the-do-loop-work-with-let/m-p/201379#M50264</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;%let month_nm1='Jan 2014$';&lt;/P&gt;&lt;P&gt;%let month_nm2='Feb 2014$';&lt;/P&gt;&lt;P&gt;%let mon_tot=2;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro month;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %do i=1 %to &amp;amp;mon_tot %by 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let mname&amp;amp;i=%sysfunc(compress(&amp;amp;&amp;amp;month_nm&amp;amp;i,%str($%')));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %put mname&amp;amp;i: &amp;amp;&amp;amp;mname&amp;amp;i;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %end;&lt;/P&gt;&lt;P&gt;%mend month;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%month;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 14 Mar 2015 08:12:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-the-do-loop-work-with-let/m-p/201379#M50264</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2015-03-14T08:12:34Z</dc:date>
    </item>
    <item>
      <title>Re: how the do loop work with %let</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-the-do-loop-work-with-let/m-p/201380#M50265</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;sorry all,&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;its not mname1 its &amp;amp;mname1 to &amp;amp;mname12&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;Just now edited.&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;SPAN style="font-size: 13.3333330154419px; line-height: 1.5em;"&gt;In the open code the variables are not working.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;%put &amp;amp;mname1;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;%put&amp;nbsp; &amp;amp;mname2;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;how the macro variables are working open code.&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;i used %global statement within the macro but the variables are not working in open code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 14 Mar 2015 08:26:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-the-do-loop-work-with-let/m-p/201380#M50265</guid>
      <dc:creator>Ravikumarkummari</dc:creator>
      <dc:date>2015-03-14T08:26:20Z</dc:date>
    </item>
    <item>
      <title>Re: how the do loop work with %let</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-the-do-loop-work-with-let/m-p/201381#M50266</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It works with the sample code. If your actual code is different then may be you post it (especially the section where you create &amp;amp;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;month_nm&amp;lt;n&amp;gt;). Post the error log (using options mprint) as well because this will be more helpful to us than just you writing "it's not working".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let month_nm1='Jan 2014$';&lt;/P&gt;&lt;P&gt;%let month_nm2='Feb 2014$';&lt;/P&gt;&lt;P&gt;%let mon_tot=2;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro month;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %do i=1 %to &amp;amp;mon_tot %by 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %global mname&amp;amp;i;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let mname&amp;amp;i=%sysfunc(compress(&amp;amp;&amp;amp;month_nm&amp;amp;i,%str($%')));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %put mname&amp;amp;i: &amp;amp;&amp;amp;mname&amp;amp;i;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %end;&lt;/P&gt;&lt;P&gt;%mend month;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%month;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%put mname1: &amp;amp;mname1;&lt;/P&gt;&lt;P&gt;%put mname2: &amp;amp;mname2;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 14 Mar 2015 08:37:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-the-do-loop-work-with-let/m-p/201381#M50266</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2015-03-14T08:37:38Z</dc:date>
    </item>
    <item>
      <title>Re: how the do loop work with %let</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-the-do-loop-work-with-let/m-p/201382#M50267</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could use %SCAN() if your data is in that format.&amp;nbsp; Just use ' and $ as the delimiters.&amp;nbsp; Note you can code the delimiter list as '$' to avoid unbalanced quotes and the need for macro quoting.&amp;nbsp; It doesn't matter if an individual delimiter appears more than once in the list.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; sheet1='Jan 2014$';&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; sheet2='Feb 2014$';&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; sheetN=2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; month1 = Before;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; month2 = Before;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;%macro&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &lt;STRONG&gt;&lt;EM&gt;sheet2month&lt;/EM&gt;&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%do&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; i=&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%to&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &amp;amp;sheetn ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; month&amp;amp;i=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%scan&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;(&amp;amp;&amp;amp;sheet&amp;amp;i,1,'$') ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;%mend&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; sheet2month;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;%&lt;STRONG&gt;&lt;EM&gt;sheet2month&lt;/EM&gt;&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%put&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &amp;amp;=sheet1 &amp;amp;=month1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%put&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &amp;amp;=sheet2 &amp;amp;=month2;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 14 Mar 2015 13:26:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-the-do-loop-work-with-let/m-p/201382#M50267</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-03-14T13:26:51Z</dc:date>
    </item>
    <item>
      <title>Re: how the do loop work with %let</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-the-do-loop-work-with-let/m-p/201383#M50268</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your original code looks good . except don't put quote in macro function .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let month_nm1='Jan 2014$';&lt;/P&gt;&lt;P&gt;%let month_nm2='Feb 2014$';&lt;/P&gt;&lt;P&gt;%let mon_tot=2;&lt;/P&gt;&lt;P&gt;%macro month;&lt;/P&gt;&lt;P&gt;%do i=1 %to &amp;amp;mon_tot %by 1; &lt;/P&gt;&lt;P&gt;%let mname&amp;amp;i=%sysfunc(compress(&amp;amp;&amp;amp;month_nm&amp;amp;i,$, p));&lt;/P&gt;&lt;P&gt;%put &amp;amp;&amp;amp;mname&amp;amp;i ;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;%mend month;&lt;/P&gt;&lt;P&gt;%month&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 14 Mar 2015 14:24:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-the-do-loop-work-with-let/m-p/201383#M50268</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-03-14T14:24:53Z</dc:date>
    </item>
  </channel>
</rss>

