Date: Fri, 10 Aug 2001 05:30:43 -0700
Reply-To: "Terjeson, Mark" <TerjeMW@DSHS.WA.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Terjeson, Mark" <TerjeMW@DSHS.WA.GOV>
Subject: Re: Is this valid code to rename?
Content-Type: text/plain; charset=iso-8859-1
HI Paula,
If you move one of the semicolons, it will work just fine!
Move the semicolon after the d&i in the existing line:
data test(rename=(%do i=1 %to 114; c&i=d&i;%end));
to right after the %end as shown here:
data test(rename=(%do i=1 %to 114; c&i=d&i %end;));
Leaving a space there as above is optional.
The %end statement needs a semicolon and the text
you want created in the rename option you don't want
semicolons between each c1=d1 c2=d2 c3=d3..... etc.
Thus,
* create sample data ;
data dataname;
array c{114} c1-c114;
run;
%macro a;
data test(rename=(%do i=1 %to 114;c&i=d&i %end;));
set dataname;
run;
%mend;
%a;
Hope this is helpful,
Mark Terjeson
Washington State Department of Social and Health Services
Division of Research and Data Analysis (RDA)
mailto:terjemw@dshs.wa.gov
-----Original Message-----
From: sophe@USA.NET [mailto:sophe@USA.NET]
Sent: Thursday, August 09, 2001 7:28 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Is this valid code to rename?
This is the SAS code that I saw today
%macro a;
data test(rename=(%do i=1 %to 114; c&i=d&i;%end));
set dataname;
run;
%mend;
%a;
It is intended to rename variables c1-c114 to d1-d114. Can people really do
the macro do loop in this fashion?
Paula D