hi, I want to create a string of dataset (table) names in TAQMSEC library and separate names by a space. Here since the name format is TAQMSEC.CTM_XXXXXXXX, I want to create a string which looks like: "TAQMSEC.CTM_20150101 TAQMSEC.CTM_20150102 TAQMSEC.CTM_20150103...". Can someone help me?
If the datasets already exist then query the system metadata to generate the list.
proc sql noprint;
select catx('.',libname,nliteral(memname))
into :memlist separated by ' '
from dictionary.member
where libname='TAQMSEC'
and memtype in ('DATA','VIEW')
;
%let nds=&sqlobs;
quit;
%put Found &nds members in TAQMSEC libref : &memlist ;
You might want to also filter on MEMNAME if there are other datasets in that library you don't want to include in your list.
Hello,
Is this what you want?
data _NULL_;
LENGTH d $ 1100;
/* "TAQMSEC.CTM_20150101 TAQMSEC.CTM_20150102 TAQMSEC.CTM_20150103...". Can someone help me? */
d="";
do i=0 to 30;
a='01JAN2015'd;
b=put(a,yymmddn8.);
c=INTNX('DAY',a,i);
put c= yymmddn8.;
d=strip(d) !! ' ' !! 'TAQMSEC.CTM_' !! strip(put(c,yymmddn8.));
put d=;
end;
call symputx('myd',strip(d));
run;
%PUT &=myd;
Koen
If the datasets already exist then query the system metadata to generate the list.
proc sql noprint;
select catx('.',libname,nliteral(memname))
into :memlist separated by ' '
from dictionary.member
where libname='TAQMSEC'
and memtype in ('DATA','VIEW')
;
%let nds=&sqlobs;
quit;
%put Found &nds members in TAQMSEC libref : &memlist ;
You might want to also filter on MEMNAME if there are other datasets in that library you don't want to include in your list.
Thank you a lot. That is exactly what I want. BTW, in line 4, I guess it should be dictionary.members ('s' is missing).
SAS uses singular for the SASHELP views and plural for the DICTIONARY psuedo tables. Makes it hard to remember whether or not to add the S.
2226 proc sql; 2227 describe view sashelp.vmember; NOTE: SQL view SASHELP.VMEMBER is defined as: select * from DICTIONARY.MEMBERS;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.