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 (June 2002, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 17 Jun 2002 22:22:38 -0400
Reply-To:     "Schulingkamp, Michael E" <michael.e.schulingkamp@LMCO.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Schulingkamp, Michael E" <michael.e.schulingkamp@LMCO.COM>
Subject:      Building lists from macro vars
Content-type: text/plain

I'm having trouble dynamically creating variable lists inside a macro. I have a program that creates a bunch of macro variables which hold the variables to use in a proc summary step based on selections from a users inputs. For example,

byvar1, byvar2, byvar3,...,byvar&i hold the variables for the BY line and var1, var2, var3,..., var&i hold the variables for the VAR line in the proc.

I want to do something like:

%macro sum ;

%do i=1 to 50 ; %if %mvarexists(&byvar&i) %then %let byvars = &byvars &byvar&i ; /**** if this is even possible ****/ %if %mvarexists(&var&i) %then %let vars = &vars &var&i ; %end;

proc summary; by &byvars ; var &vars ; output out=sumout sum= ; run;


I've got the macro "mvarexists" written and working (thanks to the SAS-L archives!).

Thanks, Mike

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