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 (February 2007, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 9 Feb 2007 13:17:49 -0500
Reply-To:     sbarry@sbbworks.com
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Scott Barry <sbarry@SBBWORKS.COM>
Organization: SBBWorks, Inc.
Subject:      Re: %Let
Content-Type: text/plain; charset="US-ASCII"

You will need to generate a list of unique values and assign a macro variable to use in the WHERE -- there are a couple of methods to consider:

1) Use PROC SQL with SELECT DISTINCT var_name along with INTO, generating a list of unique values (as SAS macro variables), and use &SQLOBS along with a %DO/%END to iterate through the macro variable list val1-valn for your PROC whatever invocation. 2) Code a DATA step to invoke a macro substiting a WHERE statement value for each unique occurrence -- possibly, the list would be generated from a PROC SORT NODUPKEY with BY var_name to generate a SAS file, used in the DATA step to generate a SAS macro invocation with CALL EXECUTE. 3) no doubt there are other techniques which will come from the list subscribers.

Scott Barry SBBWorks, Inc.

SUGI paper with an example using PROC SQL with SELECT DISTINCT and SQLOBS. http://www2.sas.com/proceedings/sugi30/237-30.pdf

On Feb 9, 3:21 pm, "Captain" wrote:

> I am a little new to the macro using. > IN MY CODE > %Let variable1=; > proc print data=names label ; > where name="&variable1"; > run; > The problem is I want the statement to evaluate %let variable1 as > saying name=all values of name, but sas is reading it as name=missing > or nothing. > What do I need to put in the part: %let vaiable1= ; so that sas will > fill in all values of name in the part of the code: where > name="&variable1"; > thanks > -Adam


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