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 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 27 Jul 2007 17:09:16 -0000
Reply-To:   hoxiea <hoxiea@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   hoxiea <hoxiea@GMAIL.COM>
Subject:   macro variable based on do loop control variable
Comments:   To:
Content-Type:   text/plain; charset="iso-8859-1"

Hello, everyone! Just a quick question for you all on macro variables; I appreciate your assistance and thank you in advance for your help.

Working inside of a macro, I'd like to process some data sets using a do loop. I'd also like to have a variable within the do loop that's based on the value of the control variable. Specifically, I'd like the loop control variable to run from 1 to 11, and the inside variable to run from 2 to 12, each incrementing by 1 each time through the loop. In my mistaken brain, the code looks something like this:

%do i=1 %to 11; %let j=&i+1;

data both; merge code_per&i._replicates code_per&j._replicates;

However, the log file gives me an error, with the following message: NOTE: Line generated by the macro variable "J". 186 code_per1+1_replicates

How can I get SAS to read this as code_per2_replicates instead? Any thoughts? Thanks!

- Hoxie Ackerman

PS. I realize that this would seem to overwrite "both," which is something I'm not concerned about; I run some procedures on "both" and collect the output using code not included in this message, then delete "both" before the next iteration.

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