<?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: skip the do loop in macro for one i value in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/skip-the-do-loop-in-macro-for-one-i-value/m-p/367641#M87573</link>
    <description>&lt;P&gt;And why the need for macro? &amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
  array base_a{*} base:;
  array tax_a{*} tax:;
  ...
  do i=1 to dim(base_a);
    ...
  end;
run;&lt;/PRE&gt;
&lt;P&gt;There are of course various other options as well. &amp;nbsp;Restructure the data for one:&lt;/P&gt;
&lt;PRE&gt;ROW_ID  BASE  TAX  ...
1              xx        xx    ...
2              xx        xx    ...
etc.&lt;/PRE&gt;
&lt;P&gt;Then yu just apply any calculations to base or tax on a row level rather than iterating across. &amp;nbsp;Simpler coding, and if you need a report at the end with it across the page, then do a transpose the data.&lt;/P&gt;</description>
    <pubDate>Fri, 16 Jun 2017 09:40:31 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2017-06-16T09:40:31Z</dc:date>
    <item>
      <title>skip the do loop in macro for one i value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/skip-the-do-loop-in-macro-for-one-i-value/m-p/367637#M87570</link>
      <description>&lt;P&gt;Hello Expert,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need a small Doubt, I am running a do macro loop for 72 columns, means 12 categories.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 6 columns which attribute name&amp;nbsp;is repeating with increment numbers like below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Base1,tax1,com1,int1,amt1,charges1,Base2,tax2,com2,int2,amt2,charges2,Base12,tax12,com12,int12,amt12,charges12.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am generating only 3 column value (base,tax,int) in one column row wise.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%var1=base;&lt;/P&gt;&lt;P&gt;%var2=tax;&lt;/P&gt;&lt;P&gt;%var3=com;&lt;/P&gt;&lt;P&gt;%var4=int;&lt;/P&gt;&lt;P&gt;%var5=amt;&lt;/P&gt;&lt;P&gt;%var6=charges;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%do base=1 %to 12;&lt;/P&gt;&lt;P&gt;%do i=1 %to 4;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so I am generating a value&amp;nbsp;in&amp;nbsp;one&amp;nbsp;column which will take data all 4 columns.&lt;/P&gt;&lt;P&gt;Now my question is to leave third column value only to take 1,2,4 value of i.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how can we can skip one value in do macro loop.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help&amp;nbsp; me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2017 09:31:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/skip-the-do-loop-in-macro-for-one-i-value/m-p/367637#M87570</guid>
      <dc:creator>Riteshdell</dc:creator>
      <dc:date>2017-06-16T09:31:34Z</dc:date>
    </item>
    <item>
      <title>Re: skip the do loop in macro for one i value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/skip-the-do-loop-in-macro-for-one-i-value/m-p/367639#M87571</link>
      <description>&lt;P&gt;An easy patch:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%do base=1 %to 12;&lt;/P&gt;
&lt;P&gt;%do i=1 %to 4;&lt;/P&gt;
&lt;P&gt;%if &amp;amp;i ne 3 %then %do;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Macro language does not support iterating through a list of values, only iterating over a range.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another possibility:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%if &amp;amp;i=3 %then %let i=4;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2017 09:37:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/skip-the-do-loop-in-macro-for-one-i-value/m-p/367639#M87571</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-06-16T09:37:50Z</dc:date>
    </item>
    <item>
      <title>Re: skip the do loop in macro for one i value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/skip-the-do-loop-in-macro-for-one-i-value/m-p/367641#M87573</link>
      <description>&lt;P&gt;And why the need for macro? &amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
  array base_a{*} base:;
  array tax_a{*} tax:;
  ...
  do i=1 to dim(base_a);
    ...
  end;
run;&lt;/PRE&gt;
&lt;P&gt;There are of course various other options as well. &amp;nbsp;Restructure the data for one:&lt;/P&gt;
&lt;PRE&gt;ROW_ID  BASE  TAX  ...
1              xx        xx    ...
2              xx        xx    ...
etc.&lt;/PRE&gt;
&lt;P&gt;Then yu just apply any calculations to base or tax on a row level rather than iterating across. &amp;nbsp;Simpler coding, and if you need a report at the end with it across the page, then do a transpose the data.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2017 09:40:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/skip-the-do-loop-in-macro-for-one-i-value/m-p/367641#M87573</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-06-16T09:40:31Z</dc:date>
    </item>
  </channel>
</rss>

