data test(keep=ln_no,upd_date);
set test2;
run;
sample data
ln_no upd_date
1111 6/15/14
1122 9/5/11
1122 9/11/15 (repeated)
1444 8/15/11
1166 2/8/11
1166 12/5/15 (repeated)
In ODS is there a way to place a highlight color say orange or red to highlight the ln_no column if the ln_no repeats on the next line.
In this case 1122 and 1166 repeated and I want to identify them as repeats.
1122
1166
Hi:
It is very easy to do if you just want the duplicate value "blanked out" as shown in #1 below. If you make a "helper" variable using BY group processing and make a counter whose value will be GT 1 for the dups, then you can easily highlight a cell (#3) or a whole row (#4), as shown below.
cynthia
Thanks, this works. It will show highlight the last entriy in this case ln_no in a color based on the lag function
So in this case
1111
1111 the last entry will have the color background.
Is there a way to get both to show the color background and not just the last entry
Hi,
Yes, that is possible, but not part of what you originally asked for. In order to do that, the LN_NO variable has to be defined as an ORDER variable. Do you want to see the LN_NO value on every row or not? The answer to that question has an impact on the PROC REPORT code that you will need. For this modification, you would NOT need to use the LAG approach.
cynthia
This was very easy to follow and helpful! Thank you.
data test; input ln_no upd_date : mmddyy10.; format upd_date mmddyy10.; cards; 1111 6/15/14 1122 9/5/11 1122 9/11/15 1444 8/15/11 1166 2/8/11 1166 12/5/15 ; run; proc report data=test nowd; columns ln_no upd_date; define ln_no/display; define upd_date/display; compute upd_date; if ln_no eq lag(ln_no) then call define(_row_,'style','style={background=orange}'); endcomp; run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.