LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (August 2001, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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?
Comments: To: "sophe@USA.NET" <sophe@USA.NET>
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


Back to: Top of message | Previous page | Main SAS-L page