我编写了这个程序来备份特定库中的数据集。现在我想以这样的方式修改这个程序:如果再次运行程序,那么只备份那些在两周内修改的数据集。
proc sql; 选择不同的memname into:ord_int_list以''分隔 来自sashelp.vcolumn 其中libname =“space” 按记忆名称排序; 退出;
%让ord_int_n =& sqlobs;
%宏备份();
%do i = 1 %to &ord_int_n;
%let spc = %scan(&ord_int_list, &i);
data libname.&spc. (compress = CHAR);
set ord_int.&spc.;
run;
%end;
%好转;
%备份();
答案 0 :(得分:0)
我会做类似下面代码的事情。
数据 null ;
format backup_after datetime.;
backup_after =dhms(today() - 14, 0,0,0); /* 14 days back */
call symputx('backup_after', catt('"', put(backup_after, datetime. -L), '"DT'));
run;
%put &backup_after;
proc sql;
select memname into: backup_list separated by ' ' from dictionary.tables
where libname = "space"
and modate >= &backup_after
order by memname;
quit;
proc copy in=space out=backup clone datecopy index=yes constraint=yes;
select &backup_list;
run;