Date: Wed, 2 Jul 2003 03:09:17 -0400
Reply-To: "Richard A. DeVenezia" <radevenz@IX.NETCOM.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Richard A. DeVenezia" <radevenz@IX.NETCOM.COM>
Subject: Re: macro resolution in Proc SQL
"uset sas" <sasuser9000@YAHOO.CO.UK> wrote in message
news:20030701222438.69834.qmail@web21413.mail.yahoo.com...
> Hello,
>
> I have a macro variable that containing the column names. How can I make
this one work in the where condition. I want to give the option to the user
to select as many columns he wants.
> data test;
> input subjid visitdate;
> format visitdate date9.;
> cards;
> 100 12345
> 101 13456
> 102 15890
> ;
> run;
> %let a=SUBJID VISITDATE;
> proc sql noprint;
> create table cont as
> select * from
> dictionary.columns
> where libname='WORK'
> and memname='TEST'
> /* and name in ("&wherecond.") need help here*/
> name in('SUBJID','VISITDATE')
> ;
> quit;
> Kind Regards,
> Susi Leu
>
If you don't want to quote each name you can use indexw. Note: indexw is
not a path to optimal performance in large tables.
%let namelist = var1 var2 var3;
...
and indexw ("&namelist", trim(name))
...
or you can do
and indexw (" &namelist. ", ' '||trim(name)||' ')
--
Richard A. DeVenezia, http://www.devenezia.com
|