Date: Fri, 12 Mar 2004 08:45:52 -0500
Reply-To: diskin.dennis@KENDLE.COM
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Dennis Diskin <diskin.dennis@KENDLE.COM>
Subject: Re: Get Names of Datasets from Library & Proc SQL
Content-Type: text/plain; charset="us-ascii"
Dubravko,
You just have to put your macro variable in double quotes so it will
resolve.
HTH,
Dennis Diskin
Dubravko Dolic <dubro@DOLIC.DE>
Sent by: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
03/12/2004 08:39 AM
Please respond to Dubravko Dolic
To: SAS-L@LISTSERV.UGA.EDU
cc:
Subject: Get Names of Datasets from Library & Proc SQL
Hi All!
I have a macro which produces some datasets with the same name (e.g.
dat1 dat2 dat3 dat4). The datasets should be merged later.
With the following Code I get the Names of the Datasets from a
library:
---------------code A--------------------------------------------
proc sql noprint;
select memname
into :datnam separated by ' '
from dictionary.tables
where libname = "WORK" & memname contains 'DAT';
quit;
--------------code A---------------------------------------------
Now I can merge them together:
-----code B-------
data together;
set &datnam;
run;
----code B--------
Now my Question: For programming failsafeness it would be good to give
very unique names to the datasets. So, instead of DAT some unique
String would be good (a random number or a time). I can set up a
macrovariable to produce the Dataset names but it seems not possible
to use this macro variable in the WHERE part of the proc SQL like:
where libname = "WORK" & memname contains '&globalmacvar';
I guess it has to do something with the quoting issue but %nrbquote
and friends won't work on that.
Any hints?
Thanks and regards.
Dubravko