<?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: Do loop iteration to rename variables... in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Do-loop-iteration-to-rename-variables/m-p/161776#M31430</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you need to explain the desire results a little better...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However simple do loop (needs to be enclosed in a Macro and data step)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%do i=1 %to 9 ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ExampleB&amp;amp;i. = ExampleA&amp;amp;i. ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From a simple google&amp;nbsp; "&lt;A href="http://support.sas.com/resources/papers/proceedings11/113-2011.pdf" title="http://support.sas.com/resources/papers/proceedings11/113-2011.pdf"&gt;http://support.sas.com/resources/papers/proceedings11/113-2011.pdf&lt;/A&gt;"&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 02 Dec 2013 22:18:25 GMT</pubDate>
    <dc:creator>twocanbazza</dc:creator>
    <dc:date>2013-12-02T22:18:25Z</dc:date>
    <item>
      <title>Do loop iteration to rename variables...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-loop-iteration-to-rename-variables/m-p/161774#M31428</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm sure that this is simple but I'm new to loops and iterations. After spending hours getting nowhere I figured I'd try here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to rename a set of variables as follows&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ExampleA = ExampleA1;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;ExampleB = ExampleB1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;output;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;But I want the above to do this for 1-9.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;easy enough to just copy and change the final number manually but is really like to use a loop or Marco or something...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Any thoughts?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;G&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Dec 2013 21:54:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-loop-iteration-to-rename-variables/m-p/161774#M31428</guid>
      <dc:creator>gstullo</dc:creator>
      <dc:date>2013-12-02T21:54:48Z</dc:date>
    </item>
    <item>
      <title>Re: Do loop iteration to rename variables...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-loop-iteration-to-rename-variables/m-p/161775#M31429</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you are saying that you have 18 existing variables:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ExampleA1 ... ExampleA9&lt;/P&gt;&lt;P&gt;ExampleB1 ... ExampleB9&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And you would like to change them into 9 observations with just 2 variables on each observation.&amp;nbsp; If that's the problem you're trying to solve, this would be a viable approach:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;array a {9} ExampleA1 - ExampleA9;&lt;/P&gt;&lt;P&gt;array b {9} ExampleB1 - ExampleB9;&lt;/P&gt;&lt;P&gt;do _n_=1 to 9;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; ExampleA = a{_n_};&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; ExampleB = b{_n_};&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;keep ExampleA ExampleB;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course, if you're trying to accomplish something different, that's another story.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Dec 2013 22:11:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-loop-iteration-to-rename-variables/m-p/161775#M31429</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2013-12-02T22:11:44Z</dc:date>
    </item>
    <item>
      <title>Re: Do loop iteration to rename variables...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-loop-iteration-to-rename-variables/m-p/161776#M31430</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you need to explain the desire results a little better...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However simple do loop (needs to be enclosed in a Macro and data step)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%do i=1 %to 9 ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ExampleB&amp;amp;i. = ExampleA&amp;amp;i. ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From a simple google&amp;nbsp; "&lt;A href="http://support.sas.com/resources/papers/proceedings11/113-2011.pdf" title="http://support.sas.com/resources/papers/proceedings11/113-2011.pdf"&gt;http://support.sas.com/resources/papers/proceedings11/113-2011.pdf&lt;/A&gt;"&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Dec 2013 22:18:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-loop-iteration-to-rename-variables/m-p/161776#M31430</guid>
      <dc:creator>twocanbazza</dc:creator>
      <dc:date>2013-12-02T22:18:25Z</dc:date>
    </item>
    <item>
      <title>Re: Do loop iteration to rename variables...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-loop-iteration-to-rename-variables/m-p/161777#M31431</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the tip.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I had read that article and, at first thought that my leaving the "." out after the "i" was causing this not to work.&amp;nbsp; With or without the period, I was getting the same result of 176 observations instead of the expected 848.&amp;nbsp; I finally noticed that my output statement was outside of the Do loop rather than within it which created the missing observation problem.&amp;nbsp; Once I fixed that, I got the expected results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To answer your question, user Astounding was correct in assuming that I had several variables 1-5 (not 9) that I wanted condensed.&amp;nbsp; My initial code worked fine but the Macro version is shorter less error prone.&amp;nbsp; I've posted the initial code followed by the working macro version:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;INITIAL (obnoxiously long) CODE:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data Log (keep=SubjectID VisitDate Initials Age TeamReferred SelfReferred PfPositive PfDensity EpisodeNumber Antimalarials Comments);&lt;/P&gt;&lt;P&gt;&amp;nbsp; set data9;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; SubjectId=MalariaLogID1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; VisitDate=MalariaEpisodeDate1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Initials=PatientInitials1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Age=PatientAge1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; TeamReferred=ReferredByStudyTeam1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; SelfReferred=SelfReferral1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; PfPositive=PfPositive1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; PfDensity=PfDens1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; EpisodeNumber=EpisodeNumber1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Antimalarials=AntimalarialProvided1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Comments=Comments1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; SubjectId=MalariaLogID2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; VisitDate=MalariaEpisodeDate2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Initials=PatientInitials2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Age=PatientAge2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; TeamReferred=ReferredByStudyTeam2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; SelfReferred=SelfReferral2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; PfPositive=PfPositive2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; PfDensity=PfDens2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; EpisodeNumber=EpisodeNumber2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Antimalarials=AntimalarialProvided2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Comments=Comments2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; SubjectId=MalariaLogID3;&lt;/P&gt;&lt;P&gt;&amp;nbsp; VisitDate=MalariaEpisodeDate3;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Initials=PatientInitials3;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Age=PatientAge3;&lt;/P&gt;&lt;P&gt;&amp;nbsp; TeamReferred=ReferredByStudyTeam3;&lt;/P&gt;&lt;P&gt;&amp;nbsp; SelfReferred=SelfReferral3;&lt;/P&gt;&lt;P&gt;&amp;nbsp; PfPositive=PfPositive3;&lt;/P&gt;&lt;P&gt;&amp;nbsp; PfDensity=PfDens3;&lt;/P&gt;&lt;P&gt;&amp;nbsp; EpisodeNumber=EpisodeNumber3;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Antimalarials=AntimalarialProvided3;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Comments=Comments3;&lt;/P&gt;&lt;P&gt;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; SubjectId=MalariaLogID4;&lt;/P&gt;&lt;P&gt;&amp;nbsp; VisitDate=MalariaEpisodeDate4;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Initials=PatientInitials4;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Age=PatientAge4;&lt;/P&gt;&lt;P&gt;&amp;nbsp; TeamReferred=ReferredByStudyTeam4;&lt;/P&gt;&lt;P&gt;&amp;nbsp; SelfReferred=SelfReferral4;&lt;/P&gt;&lt;P&gt;&amp;nbsp; PfPositive=PfPositive4;&lt;/P&gt;&lt;P&gt;&amp;nbsp; PfDensity=PfDens4;&lt;/P&gt;&lt;P&gt;&amp;nbsp; EpisodeNumber=EpisodeNumber4;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Antimalarials=AntimalarialProvided4;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Comments=Comments4;&lt;/P&gt;&lt;P&gt;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; SubjectId=MalariaLogID5;&lt;/P&gt;&lt;P&gt;&amp;nbsp; VisitDate=MalariaEpisodeDate5;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Initials=PatientInitials5;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Age=PatientAge5;&lt;/P&gt;&lt;P&gt;&amp;nbsp; TeamReferred=ReferredByStudyTeam5;&lt;/P&gt;&lt;P&gt;&amp;nbsp; SelfReferred=SelfReferral5;&lt;/P&gt;&lt;P&gt;&amp;nbsp; PfPositive=PfPositive5;&lt;/P&gt;&lt;P&gt;&amp;nbsp; PfDensity=PfDens5;&lt;/P&gt;&lt;P&gt;&amp;nbsp; EpisodeNumber=EpisodeNumber5;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Antimalarials=AntimalarialProvided5;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Comments=Comments5;&lt;/P&gt;&lt;P&gt;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format VisitDate MMDDYY10.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format SubjectID ML_format.;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data Log;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set Log;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if SubjectID="" then delete;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=Log;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by SubjectID;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SHORT MACRO VERSION:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro MacroTest;&lt;/P&gt;&lt;P&gt;data MacroTest (keep=SubjectID VisitDate Initials Age TeamReferred SelfReferred&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PfPositive PfDensity EpisodeNumber Antimalarials Comments);&lt;/P&gt;&lt;P&gt;&amp;nbsp; set data9;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %DO i = 1 %to 5;&lt;/P&gt;&lt;P&gt;&amp;nbsp; SubjectId=MalariaLogID&amp;amp;i;&lt;/P&gt;&lt;P&gt;&amp;nbsp; VisitDate=MalariaEpisodeDate&amp;amp;i;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Initials=PatientInitials&amp;amp;i;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Age=PatientAge&amp;amp;i;&lt;/P&gt;&lt;P&gt;&amp;nbsp; TeamReferred=ReferredByStudyTeam&amp;amp;i;&lt;/P&gt;&lt;P&gt;&amp;nbsp; SelfReferred=SelfReferral&amp;amp;i;&lt;/P&gt;&lt;P&gt;&amp;nbsp; PfPositive=PfPositive&amp;amp;i;&lt;/P&gt;&lt;P&gt;&amp;nbsp; PfDensity=PfDens&amp;amp;i;&lt;/P&gt;&lt;P&gt;&amp;nbsp; EpisodeNumber=EpisodeNumber&amp;amp;i;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Antimalarials=AntimalarialProvided&amp;amp;i;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Comments=Comments&amp;amp;i;&lt;/P&gt;&lt;P&gt;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %end;&lt;/P&gt;&lt;P&gt;format VisitDate MMDDYY10.;&lt;/P&gt;&lt;P&gt;format SubjectID ML_format.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data MacroTest;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set MacroTest;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if SubjectID="" then delete;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=MacroTest;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by SubjectID;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%Mend MacroTest;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Dec 2013 02:18:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-loop-iteration-to-rename-variables/m-p/161777#M31431</guid>
      <dc:creator>gstullo</dc:creator>
      <dc:date>2013-12-03T02:18:29Z</dc:date>
    </item>
    <item>
      <title>Re: Do loop iteration to rename variables...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-loop-iteration-to-rename-variables/m-p/161778#M31432</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the reply.&amp;nbsp; You stated my intention correctly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I came up with the following which gave me what I wanted though I found it slightly more cumbersome to program.&amp;nbsp; If you would no mind having a look at this as well as the Macro version that I posted in reply to Barry and letting me know if you see a benefit to one version over another, I'd appreciate it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This was great though as I've been meaning to learn arrays.&amp;nbsp; I'll be dissecting this and learning how it works tomorrow:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data ArrayTest (keep=SubjectID VisitDate Initials Age TeamReferred SelfReferred&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PfPositive PfDensity EpisodeNumber Antimalarials Comments);&lt;/P&gt;&lt;P&gt;&amp;nbsp; set data9;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array a {5} MalariaLogID1-MalariaLogID5;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array b {5} MalariaEpisodeDate1-MalariaEpisodeDate5;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array c {5} PatientInitials1-PatientInitials5;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array d {5} PatientAge1-PatientAge5;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array e {5} ReferredByStudyTeam1-ReferredByStudyTeam5;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array f {5} SelfReferral1-SelfReferral5;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array g {5} PfPositive1-PfPositive5;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array h {5} PfDens1-PfDens5;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array i {5} EpisodeNumber1-EpisodeNumber5;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array j {5} AntimalarialProvided1-AntimalarialProvided5;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array k {5} Comments1-Comments5;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do n =1 to 5;&lt;/P&gt;&lt;P&gt;&amp;nbsp; SubjectID=a{n};&lt;/P&gt;&lt;P&gt;&amp;nbsp; VisitDate=b{n};&lt;/P&gt;&lt;P&gt;&amp;nbsp; Initials=c{n};&lt;/P&gt;&lt;P&gt;&amp;nbsp; Age=d{n};&lt;/P&gt;&lt;P&gt;&amp;nbsp; TeamReferred=e{n};&lt;/P&gt;&lt;P&gt;&amp;nbsp; SelfReferred=f{n};&lt;/P&gt;&lt;P&gt;&amp;nbsp; PfPositive=g{n};&lt;/P&gt;&lt;P&gt;&amp;nbsp; PfDensity=h{n};&lt;/P&gt;&lt;P&gt;&amp;nbsp; EpisodeNumber=i{n};&lt;/P&gt;&lt;P&gt;&amp;nbsp; Antimalarials=j{n};&lt;/P&gt;&lt;P&gt;&amp;nbsp; Comments=k{n};&lt;/P&gt;&lt;P&gt;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format VisitDate MMDDYY10.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format SubjectID ML_format.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data ArrayTest;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set ArrayTest;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if SubjectID="" then delete;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=Arraytest;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by SubjectID;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Dec 2013 02:23:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-loop-iteration-to-rename-variables/m-p/161778#M31432</guid>
      <dc:creator>gstullo</dc:creator>
      <dc:date>2013-12-03T02:23:46Z</dc:date>
    </item>
  </channel>
</rss>

