<?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 with by statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-do-loop-with-by-statement/m-p/462321#M117695</link>
    <description>&lt;P&gt;You can't call a dataset c_0.25 for example either.&amp;nbsp; Why do you want to split similar data out in the first place, it just makes any further code much harder to write and takes more disk space?&lt;/P&gt;
&lt;P&gt;I suppose you could do:&lt;/P&gt;
&lt;PRE&gt;data _null_;
  do i=0 to 1 by 0.25;
    call execute(cats('data c_',tranwrd(put(i,best.),".","_"),'; set individuals; where contractbypc=',put(i,best.),'; run;'));
  end;
run;&lt;/PRE&gt;</description>
    <pubDate>Tue, 15 May 2018 12:25:49 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2018-05-15T12:25:49Z</dc:date>
    <item>
      <title>Macro do loop with by statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-do-loop-with-by-statement/m-p/462310#M117685</link>
      <description>&lt;P&gt;Dear SAS users,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am running the following code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro do_all;
%do i=0 %to 1 %by 0.25;
options mprint symbolgen;

Data c_&amp;amp;i;
set individuals;
contractbypc=&amp;amp;i;
keep klantnummer treated year contractbypc;
run;

%end;
%mend do_all;
%do_all;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I am getting the following error msg:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was:&lt;/P&gt;&lt;P&gt;.25&lt;/P&gt;&lt;P&gt;ERROR: The %BY value of the %DO I loop is invalid.&lt;/P&gt;&lt;P&gt;ERROR: The macro DO_ALL will stop executing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know its the %by part of the statement than is wrong, but I don't know how to fix it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;K.&lt;/P&gt;</description>
      <pubDate>Tue, 15 May 2018 11:56:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-do-loop-with-by-statement/m-p/462310#M117685</guid>
      <dc:creator>GKati</dc:creator>
      <dc:date>2018-05-15T11:56:34Z</dc:date>
    </item>
    <item>
      <title>Re: Macro do loop with by statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-do-loop-with-by-statement/m-p/462316#M117690</link>
      <description>&lt;P&gt;You can't use fractional or decimal arithmetic in a macro %DO statement. You can only use integers. Here is a solution to use non-integer values in a %DO statement:&amp;nbsp;&lt;A href="http://documentation.sas.com/?docsetId=mcrolref&amp;amp;docsetTarget=p02f7difkhfytsn1dzhaas0rdf4n.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank"&gt;http://documentation.sas.com/?docsetId=mcrolref&amp;amp;docsetTarget=p02f7difkhfytsn1dzhaas0rdf4n.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 May 2018 12:10:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-do-loop-with-by-statement/m-p/462316#M117690</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-05-15T12:10:53Z</dc:date>
    </item>
    <item>
      <title>Re: Macro do loop with by statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-do-loop-with-by-statement/m-p/462321#M117695</link>
      <description>&lt;P&gt;You can't call a dataset c_0.25 for example either.&amp;nbsp; Why do you want to split similar data out in the first place, it just makes any further code much harder to write and takes more disk space?&lt;/P&gt;
&lt;P&gt;I suppose you could do:&lt;/P&gt;
&lt;PRE&gt;data _null_;
  do i=0 to 1 by 0.25;
    call execute(cats('data c_',tranwrd(put(i,best.),".","_"),'; set individuals; where contractbypc=',put(i,best.),'; run;'));
  end;
run;&lt;/PRE&gt;</description>
      <pubDate>Tue, 15 May 2018 12:25:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-do-loop-with-by-statement/m-p/462321#M117695</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-05-15T12:25:49Z</dc:date>
    </item>
  </channel>
</rss>

