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 (July 2007, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 11 Jul 2007 22:47:24 -0400
Reply-To:     "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject:      Re: rename in macro

On Tue, 10 Jul 2007 07:22:50 -0700, Dirk Nachbar <dirknbr@GOOGLEMAIL.COM> wrote:

>Dear all > >Within a macro I want to rename &num_vars variables using the >substring function, thereby exluding the ending p&i. Unfortunately SAS >complains about the substr, although the mprint looks ok. Why?? > > >data csv&i; > set lib1.promo (keep=company week &mvar); > %do j=1 %to &num_vars; > rename &&var&j=substr(&&var&j,1,index(&&var&j,"p&i")-1); > %end; > run; > >Dirk

I don't think anyone has explained *why* this did not work. It generates RENAME statements which have *expressions* rather than simple names following the equal sign. That's not allowed, whether generated by a macroor hard-coded.


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