BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
AMIN_DA
Fluorite | Level 6

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:

Add1Add2
11 JANE ST11 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?

1 ACCEPTED SOLUTION

Accepted Solutions
AMIN_DA
Fluorite | Level 6

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.

Add1Add2
11 JANE ST11 JANE ST
3131204A616E652053742020202020203131204A414E45205354202020202020

 

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,

View solution in original post

3 REPLIES 3
Reeza
Super User

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;

 

 

AMIN_DA
Fluorite | Level 6

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.

Add1Add2
11 JANE ST11 JANE ST
3131204A616E652053742020202020203131204A414E45205354202020202020

 

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,

AMIN_DA
Fluorite | Level 6

it was fixed by COMPARE(TRIM(UPCASE(Add1 )), TRIM(UPCASE( Add2)))

thanks again Reeza

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 2597 views
  • 0 likes
  • 2 in conversation