Hi,
Code -
%macro aa; %do I = 1 %to 4; PROC SQL NOPRINT ; SELECT ID INTO : ITEM FROM TEST WHERE N = &I.; QUIT;
PROC SQL NOPRINT ; SELECT VALUES INTO : other_items FROM TEST WHERE N = &I.; QUIT;
%PUT &ITEM. &other_items.; proc report data=TEST; column ID A1-A7 VALUES;
compute A1; IF ID = &item. and A1 IN &other_items. THEN call define('A1', "style", "style=[background=lightgreen]"); endcomp;
compute A2; IF ID = &item. and A2 IN &other_items. then call define('A2', "style", "style=[background=lightgreen]"); endcomp;
compute A3; IF ID = &item. and A3 IN &other_items. then call define('A3', "style", "style=[background=lightgreen]"); endcomp;
compute A4; IF ID = &item. and A4 IN &other_items. then call define('A4', "style", "style=[background=lightgreen]"); endcomp;
compute A5; IF ID = &item. and A5 IN &other_items. then call define('A5', "style", "style=[background=lightgreen]"); endcomp;
compute A6; IF ID = &item. and A6 IN &other_items. then call define('A6', "style", "style=[background=lightgreen]"); endcomp;
compute A7; IF ID = &item. and A7 IN &other_items. then call define('A7', "style", "style=[background=lightgreen]"); endcomp; %END; %mend; %AA;
run;
output from above code-
Output I need -
I need output on the basis of id and VALUES column and highlight the cells A1-A7 according to values in column VALUES.
Here ID is a unique identifier and one ID has only one unique value in VALUES column.
Dataset test is attached for your reference.
... View more