Hi monthly I will receive weekly datasets like XYZ_WK1, XYZ_WK2. few months I will receive 4 and few months 5. when I use SET/APPEND to Append data to Base table when one file is missed showing error message how to over come irrespective of datasets number need to append all data sets which are available.
data SOURCE.XYZ ;
set TARGET.XYZ_wk1
TARGET.XYZ_wk2
TARGET.XYZ_wk3
TARGET.XYZ_wk4
TARGET.XYZ_wk5
;
run;
or
proc append base=SOURCE.XYZ data=TARGET.XYZ_wk1;
run;
proc append base=SOURCE.XYZ data=TARGET.XYZ_wk2;
run;
proc append base=SOURCE.XYZ data=TARGET.XYZ_wk3;
run;
proc append base=SOURCE.XYZ data=TARGET.XYZ_wk4;
run;
Here is one way:
proc sql noprint;
select catx('.',libname,memname)
into :files separated by ' '
from dictionary.tables
where libname="TARGET" and
memname like "XYZ%"
;
quit;
data target.xyz;
set &files.;
run;
Here is one way:
proc sql noprint;
select catx('.',libname,memname)
into :files separated by ' '
from dictionary.tables
where libname="TARGET" and
memname like "XYZ%"
;
quit;
data target.xyz;
set &files.;
run;
I think your list of dataset names will need to include the libname.
select catx('.',libname,memname) ....
Tom,
You are absolutely correct, me bad, and I corrected my original post based on your post. As for the wild card, I didn't suggest it as (as I recall) that was only made available as of 9.3
Art
If your names all start with the same prefix then you could use a wildcard in the SET statement. (Note your LIBREF names seems backwards to me so I have reversed them in my example code below).
data target.xyz ;
set source.xyz_wk: ;
run;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.