Help using Base SAS procedures

Proc report conditional highliting

Accepted Solution Solved
Reply
Occasional Contributor J_C
Occasional Contributor
Posts: 18
Accepted Solution

Proc report conditional highliting

Hi,

I am currently trying to highlight certain cells in proc report that satisfy a certain condition.

proc report data=work.inner_corp nowd center;

  column (connection ('Facility IG' comm_fac_ig_past comm_fac_ig_current comm_fac_ig_flag)

  ('Overthreshold' comm_oth_past comm_oth_current comm_oth_delta)

  ('Category' category_past category_current)

  ('Upgrade Flag' upgrade_flag_past upgrade_flag_current)

  ('Paydown Flag' paydown_flag_past paydown_flag_current));

  where coalesce(category_current,category_past)>=3;

  define connection/display 'Connection';

  define comm_fac_ig_past/display "&date_db2_1_qtr_ago.";

  define comm_fac_ig_current/display "&date_db2.";

  define comm_fac_ig_flag/display center 'Change?';

  define comm_oth_past/display  style={tagattr='format:#,##0,,'} "&date_db2_1_qtr_ago.";

  define comm_oth_current/display style={tagattr='format:#,##0,,'} "&date_db2.";

  define comm_oth_delta/analysis style={tagattr='format:#,##0,,'} 'Delta';

  define category_past/display "&date_db2_1_qtr_ago.";

  define category_current/display "&date_db2.";

  define upgrade_flag_past/display center "&date_db2_1_qtr_ago.";

  define upgrade_flag_current/display center "&date_db2.";

  define paydown_flag_past/display center "&date_db2_1_qtr_ago.";

  define paydown_flag_current/display center "&date_db2.";

  compute comm_fac_ig_past;

  if comm_fac_ig_flag="Y" then;

  call define ('comm_fac_ig_past', 'style', 'style=[background=yellow]');

  endcomp;

  rbreak after / summarize suppress ol ul skip page;

run;

All it does is highlight the entire comm_fac_ig_past column.

Any suggestions?

Thanksr


Accepted Solutions
Solution
‎07-26-2014 08:13 PM
SAS Super FREQ
Posts: 8,744

Re: Proc report conditional highliting

Hi:

  Two basic facts about PROC REPORT:

1) PROC REPORT does NOT have a Program Data Vector. It ONLY knows what has been placed on the report row.

2) So that means PROC REPORT moves from Left to Right when placing items on the report row.

  Those 2 facts means something like this:

column var1 var2 var3 var4 var5;

  In a COMPUTE block for var3 (for example), you could apply highlighting to VAR3, VAR2 or VAR1 (anything to the LEFT of VAR3), but since VAR4 and VAR5 have not yet been placed on the report row, you cannot do the following:

a) use VAR4 or VAR5 in a COMPUTE block for VAR3 (they don't technically have a value on the report row until AFTER PROC REPORT puts them on the row

b) highlight VAR4 or VAR5  in the COMPUTE block for VAR3 (the only exception to this is if VAR3 does a call define on the _ROW_ (such as when you are doing highlighting for the whole row based on the value of VAR3)

  But, your example looks like a violation of #2 and a) in the rules above. It seems to me that comm_fac_ig_past appears in the column statement BEFORE comm_fac_ig_flag which means that you CANNOT use  comm_fac_ig_flag for highlighting in the COMPUTE block for  comm_fac_ig_past.

cynthia

View solution in original post


All Replies
Solution
‎07-26-2014 08:13 PM
SAS Super FREQ
Posts: 8,744

Re: Proc report conditional highliting

Hi:

  Two basic facts about PROC REPORT:

1) PROC REPORT does NOT have a Program Data Vector. It ONLY knows what has been placed on the report row.

2) So that means PROC REPORT moves from Left to Right when placing items on the report row.

  Those 2 facts means something like this:

column var1 var2 var3 var4 var5;

  In a COMPUTE block for var3 (for example), you could apply highlighting to VAR3, VAR2 or VAR1 (anything to the LEFT of VAR3), but since VAR4 and VAR5 have not yet been placed on the report row, you cannot do the following:

a) use VAR4 or VAR5 in a COMPUTE block for VAR3 (they don't technically have a value on the report row until AFTER PROC REPORT puts them on the row

b) highlight VAR4 or VAR5  in the COMPUTE block for VAR3 (the only exception to this is if VAR3 does a call define on the _ROW_ (such as when you are doing highlighting for the whole row based on the value of VAR3)

  But, your example looks like a violation of #2 and a) in the rules above. It seems to me that comm_fac_ig_past appears in the column statement BEFORE comm_fac_ig_flag which means that you CANNOT use  comm_fac_ig_flag for highlighting in the COMPUTE block for  comm_fac_ig_past.

cynthia

Occasional Contributor J_C
Occasional Contributor
Posts: 18

Re: Proc report conditional highliting

This explains it well. Thank you!

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 256 views
  • 0 likes
  • 2 in conversation