I have a Proc Report that goes like this
Proc Report Data=Table1;
Column A B C;
compute A;
if B eq 0 then call define(_col_,"style","style={font_weight=bold}");
endcomp;
Run;
However, it doesn't work.
The log says that B is uninitialized. Is there a way to solve it? Thanks before.
compute A; ----> compute B; or compute C;
proc reports reads the variable from left to right, when computing A, B has no value. You have to clone B:
Proc Report Data=Table1;
columns B=_B A B C;
define _b / noprint;
compute A;
if _b eq 0 then call define(_col_,"style","style={font_weight=bold}");
endcomp;
run;
compute block is calculated from left to right. So when you compute it at A , SAS can't know the value of B, because B is after A. Change : compute A; ----> compute B; or compute C;
I try to do like below (re-arranging the column)
Proc Report Data=Table1;
Column B A C;
compute A:
if B eq 0 then call define(_col_,"style","style={font_weight=bold}");
endcomp;
Run;
And still unsuccesful, can you let me know what did I miss out? Thanks.
You are defining _COL_ ,so you can only highlight A not B. Change it as compute B:
Hi: for a concrete example of how PROC REPORT works, review this related posting:
It has some pseudo-code examples of PROC REPORT's left-to-right processing and how a COMPOUND name has to be used for numeric variables.
cynthia
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.