Ok, that worked, so now im a bit further and i have an other problem
The loop for the rowfilters isn't working correct, it always crashes..
[pre]
%macro makeHTMLtable(table=,width=,keepvariables=,rowfilters=);
/* Calculate the number of variables in dataset and putting them in a variable seperated by spaces if the value keepvariables is not given*/
%if &keepvariables eq '' %then %do;
proc contents data = &table out = vars(keep = varnum name) noprint;
run;
proc sql noprint;
select distinct name into :orderedvars separated by ' ' from vars order by varnum;
quit;
%let numberofvariables=%sysfunc(countw(&orderedvars));
%end;
%else %do;
%let numberofvariables=%sysfunc(countw(&keepvariables));
%end;
data _null_;
file _webout ;
set &table end=oef;
/* Header Row */
if _N_ = 1 then do;
put " ";
put " ";
CounterVariable = 1;
do while(CounterVariable le &numberofvariables);
if &keepvariables eq '' then Variable = scan("&orderedvars",CounterVariable,' ');
else Variable = scan(&keepvariables,CounterVariable,' ');
put " " Variable;
put " ";
CounterVariable = CounterVariable + 1;
end;
put " ";
end;
/* DataRow */
/* Filters */
if &rowfilters ne ' ' then do;
nrfilters = count(&rowfilters,',');
do while(CounterFilter le nrfilters);
FullFilter = scan(&rowfilters,CounterFilter,',');
field = scan(FullFilter,1,' ');
value = scan(FullFilter,2,' ');
rowstyle = scan(FullFilter,3,' ');
if vvaluex(field) eq value then put " ";
end;
end;
/*else put " ";*/
CounterVariable = 1;
do while(CounterVariable le &numberofvariables);
if &keepvariables eq '' then Variable = scan("&orderedvars",CounterVariable,' ');
else Variable = scan(&keepvariables,CounterVariable,' ');
Value = vvaluex(Variable);
put " " Value;
put " ";
CounterVariable = CounterVariable + 1;
end;
put " ";
if oef then put ' ';
run;
%mend;
%makeHTMLtable(table=prio_table_small,width=50%,keepvariables="Lot_Id Facility",rowfilters="facility PLINE200 red,Lot_Id AL100439 orange,"); [/pre]
... View more