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;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.