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
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.