<?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: Macro %do loop start in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-do-loop-start/m-p/821574#M324366</link>
    <description>great! thanks</description>
    <pubDate>Tue, 05 Jul 2022 10:34:54 GMT</pubDate>
    <dc:creator>Toni2</dc:creator>
    <dc:date>2022-07-05T10:34:54Z</dc:date>
    <item>
      <title>Macro %do loop start</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-do-loop-start/m-p/821557#M324355</link>
      <description>&lt;P&gt;I am trying to start the loop in %do expression to be equal to start_id =227&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i use the %&amp;nbsp;&lt;CODE class=" language-sas"&gt;SYSEVALF(&amp;amp;start_id.) however,&amp;nbsp;does&amp;nbsp;not&amp;nbsp;work&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;i&amp;nbsp;want&amp;nbsp;the&amp;nbsp;proc&amp;nbsp;hpbin&amp;nbsp;to have in the WHERE statement the i which should take the values from start_id to end_id&amp;nbsp;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let start_id=227;
%let end_id=290;

%macro IV_continuous(ds=,vars=,bad=);
                                                                                                 
%let yy=%SYSEVALF((&amp;amp;end_id.-&amp;amp;start_id.)+1);

%do i=%SYSEVALF(&amp;amp;start_id.) %to &amp;amp;yy. ;
 
proc hpbin data = &amp;amp;ds. numbin = 10;
		input &amp;amp;vars.;
		where monthid = &amp;amp;i;
		ods output mapping = bin_&amp;amp;i.;
	run;

%end;
%mend;

%IV_continuous(ds=pd_data.upl_test,vars=&amp;amp;varcon,bad=bad);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2022 09:47:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-do-loop-start/m-p/821557#M324355</guid>
      <dc:creator>Toni2</dc:creator>
      <dc:date>2022-07-05T09:47:46Z</dc:date>
    </item>
    <item>
      <title>Re: Macro %do loop start</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-do-loop-start/m-p/821564#M324360</link>
      <description>&lt;P&gt;Run this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let start_id=227;
%let end_id=290;
%let yy=%SYSEVALF((&amp;amp;end_id.-&amp;amp;start_id.)+1);
%put &amp;amp;=yy.;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then manually insert the values into your %DO, and you'll see it resolves to this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%do i = 227 %to 64;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;which means the loop will never execute.&lt;/P&gt;
&lt;P&gt;Either run it from &amp;amp;start_id to %end_id, or from 1 to &amp;amp;yy.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2022 09:53:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-do-loop-start/m-p/821564#M324360</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-07-05T09:53:07Z</dc:date>
    </item>
    <item>
      <title>Re: Macro %do loop start</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-do-loop-start/m-p/821574#M324366</link>
      <description>great! thanks</description>
      <pubDate>Tue, 05 Jul 2022 10:34:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-do-loop-start/m-p/821574#M324366</guid>
      <dc:creator>Toni2</dc:creator>
      <dc:date>2022-07-05T10:34:54Z</dc:date>
    </item>
  </channel>
</rss>

