BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
J_C
Calcite | Level 5 J_C
Calcite | Level 5

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

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

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

2 REPLIES 2
Cynthia_sas
SAS Super FREQ

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

J_C
Calcite | Level 5 J_C
Calcite | Level 5

This explains it well. Thank you!

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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