Date: Fri, 9 Feb 2007 13:17:49 -0500
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.
SUGI paper with an example using PROC SQL with SELECT DISTINCT and SQLOBS.
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";
> 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