Hi All,
I would like to check if 2 addresses are equal. I am using Compare function but for the ones I assume they are equal instead of 0 I get a number.
here is my example:
Add1 | Add2 |
11 JANE ST | 11 JANE ST |
compare(Add1,Add2) but instread of 0 it SAS EG gives me 5. I checked in Excel and Excel resut is these 2 are equal.
Would you please help out with this issu?
Thank you Reeza for replying quickly.
I changed the format to $hex32. and I see they are different as below in the 9th postion from left and some other letters as well inside the string.
Add1 | Add2 |
11 JANE ST | 11 JANE ST |
3131204A616E65205374202020202020 | 3131204A414E45205354202020202020 |
I have not with HEX format before and not sure if I've got your advice right and also I dont know how to recognise if it is because of space or not. So could you please let me know how I can remove potential space inside the text if there is any solution?
Regards,
Please provide a reproducible sample so that we replicate your issue.
If you can't replicate it, it's an issue with your data. Try looking at the data with a HEX format to see if its different.
You may have spaces in one and a different invisible character in others.
Here's an example of how to use the HEX format to see the difference
data class;
set sashelp.class;
put name $hex32.;
run;
Thank you Reeza for replying quickly.
I changed the format to $hex32. and I see they are different as below in the 9th postion from left and some other letters as well inside the string.
Add1 | Add2 |
11 JANE ST | 11 JANE ST |
3131204A616E65205374202020202020 | 3131204A414E45205354202020202020 |
I have not with HEX format before and not sure if I've got your advice right and also I dont know how to recognise if it is because of space or not. So could you please let me know how I can remove potential space inside the text if there is any solution?
Regards,
it was fixed by COMPARE(TRIM(UPCASE(Add1 )), TRIM(UPCASE( Add2)))
thanks again Reeza
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.