The SAS Output Delivery System and reporting techniques

Traffic Lighting with Character Values

Regular Contributor
Posts: 247

Traffic Lighting with Character Values

Please see the attached Excel worksheet for what my final output should look like.  I have two databases (safety and clinical) that I merged together to check for inconsistencies.  For each patient, I am checking their serious adverse events (SAE) to make sure that the SOC, PT, start/stop dates, relationship, and death dates match in both databases.  I have two different types of traffic lighting that I need to do:

First, if there is an SAE that is in one database but not the other, it is noted in the SAEMISS variable, and I would like to highlight that whole row.

Second, if the SAE is in both databases, I would like to only highlight the 2 corresponding variables where there is no match.  For example, if a patient has the same SOC in both databases, but the PT name is slightly different, then I just want to highlight the two PTNAME cells for that case (and the same for any other variables that are different between databases).

I think I can highlight the rows from my first scenario by using the following code in PROC REPORT:

compute saemiss;

      if saemiss^='' then call define(_row_,"style","style={background=red}");


However, I am stuck on the second scenario.  I can find how to highlight when a numeric value is within a specified range, but I can find an example for character values that compare across observations.  Any ideas on if this is possible?

Posts: 9,325

Re: Traffic Lighting with Character Values

Posted in reply to djbateman


  This is nearly an impossible question to comment on without more information. What is the structure of the data you are sending to PROC REPORT? What does your data look like? Seeing just the COMPUTE block doesn't really help, what is ALL the PROC REPORT code? Are you actually producing this result with SAS now, of is this your desired report? PROC REPORT writes only 1 report row at a time. So generally handles highlighting or traffic lighting only on 1 report row. When PROC REPORT is writing a report row, it has no visibility of the row that came before or the row that is coming next. So, depending on what you mean by "character values that compare across observations", it's probably not do-able with PROC REPORT.

  But you might consider working with Tech Support. You can send them all your code and all your data and ask them whether the type of highlighting you want to do is possible. You might consider "pre-processing" your data for the "across observation" comparison and then use some kind of flag on every report row to provide highlighting information.


Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation