Hi All,
I have come across a strange situation where a numeric variable is zero in both the base and compare datasets, on the matching ID, and yet they are showing up in the differences output. Below is how I've set up the compare code:
proc compare base = work.base_ds
compare = work.compare_ds
listobs listvar maxprint=(25,3000) ;
ID InternalID notsorted;
attrib _ALL_ label=''; /*Get rid of labels, formats and informats for comparison.*/
format _ALL_ ;
informat _ALL_ ;
run;
Below is an example of the results:
_______________________________________________________________
|| Base Compare
InternalID || Score Score Diff. % Diff
____________ || _________ _________ _________ _________
||
8329 || 0 0 0 0
8331 || 0 0 0 0
Any ideas?
Thanks,
Huey
Format SCORE with the HEX16. format. You should see a difference perhaps in the last digit.
Format SCORE with the HEX16. format. You should see a difference perhaps in the last digit.
Or try the FUZZ= option. They are probably displaying as equal because of the format an may vary by a small amount.
If your data is such that a diference such as 1e-8 is "close enough to equal" try FUZZ= 1E-8 (OR 0.00000001) or other small value.
Differences smaller than your FUZZ value will be considered equal.
Thanks for the input ballardw, but the "difference" still shows up when I use your fuzz factor setting, even when I use a very fuzzy factor (0.001) the "difference" still shows. : |
This is yielding interesting/aggrevating information. Representing the fields in HEX16. format shows that:
Base - Score = 0000000000000000
Compare - Score = 0
So, after wondering how on earth one '0' was popping up, I finally realized that I had the MISSING='0' option set!!!
I was comparing a missing value to '0' without knowing it. The HEX format really brought that to life. Thank you.
This option was buried in my process control file, and was hard to locate. Please forgive me for wasting your time!
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.