BookmarkSubscribeRSS Feed
tanya_henderson
Obsidian | Level 7

I am creating a report for error checking data entry. I have multiple columns where the dates should all match  to reflect that each assessment was completed on the same day. I am trying to create a report that will highlight "Which of these things is not like the others". 

 

I am currently highlighting all of the visits where the dates do not match, but I would like to be able to highlight only the fields that are dissimilar to the others. 

 

Here is my current code in my proc report data step. 

 

compute date4;
if date1 ne date2 or date2 ne date3 or date3 ne date4 then do;
call define("date1", 'style', 'style=[foreground=red font_weight=bold]');
call define("date2", 'style', 'style=[foreground=red font_weight=bold]');
call define("date3", 'style', 'style=[foreground=red font_weight=bold]');
call define("date4", 'style', 'style=[foreground=red font_weight=bold]');
end;

endcomp;

2 REPLIES 2
mkeintz
PROC Star

If you have 4 dates, with values      15OCT2019, 15OCT2019,  07OCT2019, and 07OCT2019, what is your rule for identifying which one(s) is/are different?   Sure, if you have 3 identical and 1 non-identical, it's obvious,  but what if you have 2 pairs as per my question.  Or what if you have 4 distinct dates?

 

So what are you desired rules of identification?

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
tanya_henderson
Obsidian | Level 7

I do have one column that is the preferred standard to compare to but sometimes that is the odd date. So, I guess I could compare all dates to date1 and highlight the differences unless all dates are the same and date1 is the odd date. 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

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