How about this one :
data have;
infile cards dlm=",";
input
subject : $12.
F1 : $12.
F2 : $12.
F3 : $12.
F4 : $12.
F5 : $12.
F6 : $12.
;
cards;
10002, 4, 7, 9, 9, 10, 9
10001, 0, 3, 4, Total (JD), 7, Total (PP)
10006, 8, 8, 8, 0, 9, 9
10007, 8, 8, 8, Total (JD), 9, 9
10008, 8, 8, 8, 0, Total (PP), 9
;
run;
proc sql noprint;
select cat('sum(',strip(name),'="Total (JD)" or ',strip(name),'="Total (PP)") as ',strip(name)) into : list separated by ','
from dictionary.columns
where libname='WORK' and memname='HAVE' and upcase(name) like 'F%';
create table temp as
select &list from have;
quit;
data _null_;
set temp;
length drop $ 200;
array x{*} _numeric_;
do i=1 to dim(x);
if x{i} ne 0 then drop=catx(' ',drop,vname(x{i}));
end;
call symputx('drop',drop);
run;
data want;
set have(drop= &drop );
run;
Xia Keshan
... View more