| Date: | Sat, 24 Jan 2009 12:47:02 -0500 |
| Reply-To: | Oleg Solovyev <oleg.s.solovyev@GMAIL.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Oleg Solovyev <oleg.s.solovyev@GMAIL.COM> |
| Subject: | Re: data variables |
|---|
On Thu, 22 Jan 2009 06:59:41 -0800, ash007 <RamsamyAshley@GMAIL.COM> wrote:
>I want to put all the date variable in a macro variable. thanks.
>
>mv = date1 date2 ....
Ashley,
try this:
* test data set. First variable has date. format, second contains
word "date" ;
data test;
attrib
birthday length = 8
birthday format = date.
date1 length = 8
;
birthday = today();
date1 = today();
run;
* put column names into macro mv ;
proc sql noprint;
select name into :mv separated by ' '
from dictionary.columns
where libname = "WORK"
and memname = "TEST"
and (index(name,"date")>0 or
index(format,"DATE")>0
)
;
quit;
%put &mv;
* search through dictionary.columns may take much time if you have
libraries assigned using ODBC-driver.
Proc contants does't have that disadvantage ;
proc contents data = test out = columns noprint;
run;
* put columns names into macro mv2 ;
proc sql noprint;
select name into :mv2 separated by ' '
from work.columns
where index(name,"date")>0 or
index(format,"DATE")>0
;
quit;
%put &mv2;
|