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:         Wed, 19 Jun 2002 08:24:13 -0700
Reply-To:     shiling zhang <shiling99@YAHOO.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         shiling zhang <shiling99@YAHOO.COM>
Organization: http://groups.google.com/
Subject:      Re: Building lists from macro vars
Content-Type: text/plain; charset=ISO-8859-1

No sure about 'selections from a users inputs'.

When one catchs a user inputs from af interface, one can stores them into a SLIST or a data set. Then it is much easier to pass then to a macro variable. Instead one can create a statement so that the proc statement will be more dynamic.

For example, if SLIST/dataset is not empty, then <&bystatemet> will be <by var1 var2;> <&wherestament> will be <where var1 in (1,2,3,4);> else <&bystatemet> <&wherestament> just have null;

Then the proc statement will be; proc <whatever>; &bystatemet ******; &wherestament run;

Just a couple of thoughts!

michael.e.schulingkamp@LMCO.COM (Schulingkamp, Michael E) wrote in message news:<079B626B05A0D3118B1000508B0EA5E9DB0896@emss04m05.ems.lmco.com>... > 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; > > %mend; > > 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