<?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 Rename Macro Do Loop Where Value is 1 Less than Current Occurence in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Rename-Macro-Do-Loop-Where-Value-is-1-Less-than-Current/m-p/569868#M160639</link>
    <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have 10 occurrences of pxooh1-pxooh10 in wide format data.&amp;nbsp; I want to rename occurrences from 2 to 10 as starting from 1 i.e. pxooh2 is renamed ooh_ind_px_1 and pxooh3 is renamed ooh_ind_px_2 and so on up to 10.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My current code is not working:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;% macro N_renm_px2;
%do j = 2 %to 10;
pxooh&amp;amp;j=ooh_ind_px(&amp;amp;j-1)
%end;
%mend;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Any and all assistance greatly appreciated.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 28 Jun 2019 15:22:18 GMT</pubDate>
    <dc:creator>shellp55</dc:creator>
    <dc:date>2019-06-28T15:22:18Z</dc:date>
    <item>
      <title>Rename Macro Do Loop Where Value is 1 Less than Current Occurence</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-Macro-Do-Loop-Where-Value-is-1-Less-than-Current/m-p/569868#M160639</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have 10 occurrences of pxooh1-pxooh10 in wide format data.&amp;nbsp; I want to rename occurrences from 2 to 10 as starting from 1 i.e. pxooh2 is renamed ooh_ind_px_1 and pxooh3 is renamed ooh_ind_px_2 and so on up to 10.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My current code is not working:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;% macro N_renm_px2;
%do j = 2 %to 10;
pxooh&amp;amp;j=ooh_ind_px(&amp;amp;j-1)
%end;
%mend;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Any and all assistance greatly appreciated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2019 15:22:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-Macro-Do-Loop-Where-Value-is-1-Less-than-Current/m-p/569868#M160639</guid>
      <dc:creator>shellp55</dc:creator>
      <dc:date>2019-06-28T15:22:18Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Macro Do Loop Where Value is 1 Less than Current Occurence</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-Macro-Do-Loop-Where-Value-is-1-Less-than-Current/m-p/569874#M160641</link>
      <description>&lt;P&gt;&lt;STRIKE&gt;Have you tried a rename statement, I know&lt;/STRIKE&gt; it works if the index is the same and I think it should work here anyways:&lt;BR /&gt;&lt;BR /&gt;rename pxooh2 - pxooh10 = ooh_ind_px_1 - ooh_ind_px_9;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;EDIT: it works:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	array indx(*) index02-index10;

	do row=1 to 100;

		do i=1 to 9;
			indx(i)=i;
		end;
		output;
	end;
run;

data want;
	set have;
	rename index02-index10=new_index1-new_index9;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 28 Jun 2019 15:44:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-Macro-Do-Loop-Where-Value-is-1-Less-than-Current/m-p/569874#M160641</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-06-28T15:44:30Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Macro Do Loop Where Value is 1 Less than Current Occurence</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-Macro-Do-Loop-Where-Value-is-1-Less-than-Current/m-p/569879#M160644</link>
      <description>&lt;P&gt;Thanks Reeza!!&amp;nbsp;&amp;nbsp; A perfect example of my trying to make it more difficult than it is!&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2019 15:54:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-Macro-Do-Loop-Where-Value-is-1-Less-than-Current/m-p/569879#M160644</guid>
      <dc:creator>shellp55</dc:creator>
      <dc:date>2019-06-28T15:54:14Z</dc:date>
    </item>
  </channel>
</rss>

