Help using Base SAS procedures

PROC Compare and text values

Reply
Contributor
Posts: 53

PROC Compare and text values

I am comparing two datasets where the following values exist on the same records in both:

^S={font_face=Symbol}£^S={}0.25

I visually inspected the values and even copied them to EXCEL (EXCEL says they are equal)...I also used the STRIP function to remove any leading or trailing blanks. Any ideas as to why SAS says they are not equal?

Super Contributor
Posts: 282

Re: PROC Compare and text values

Hi,

Does one of the columns have a format applied to it, perhaps?

What do you get if you submit the following?:

data have1;

  a='^S={font_face=Symbol}£^S={}0.25';

run;

data have2;

  a='^S={font_face=Symbol}£^S={}0.25';

run;

proc compare base   =have1

             compare=have2;

run;

The above shows no difference on SAS 9.1.3 on PC and Mainframe.

Regards,

Amir.

Contributor
Posts: 53

Re: PROC Compare and text values

These come out the same. I think it was due to the word "symbol" having a capital letter in one instance and not in the other.

Contributor
Posts: 23

Re: PROC Compare and text values

If you do not care about case then you can use upcase() to convert the text to all be upper case when you strip out the spaces.

I often use upcase(compress(variable)) when manually coding text matching, compress removes the spaces within the text too.

Watch out for spelling mistakes when comparing text this way - I have seen 5 different ways of spelling coffee!

Super User
Posts: 11,343

Re: PROC Compare and text values

Posted in reply to MumSquared

Five ways to spell coffee is nothing, I had some survey data where IBM was spelled 18 ways. The most creative was I>B>M> .

Ask a Question
Discussion stats
  • 4 replies
  • 372 views
  • 0 likes
  • 4 in conversation