turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- Base SAS Programming
- /
- Identical numeric values are not matching in proc ...

Topic Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

2 weeks ago

Dear,

The following seq values in my data same values in both base and compare data sets. But when I run proc compare in my actual data

the values are not matched. Please suggest.

The length,informat, format in both actual datasets are 8,8.,8. respectively.

If I copy the values into 'one' and 'two' data sets (shown below) and compare the values are matching.

Thank you

Compare results showing:

SAS Output

5.3537E14 5.3537E14 -1999 -3.73E-10 |

```
data one;
input seq;
datalines;
5.354E14
;
run;
data two;
input seq;
datalines;
5.354E14
;
run;
proc compare base=one compare=two;
run;
```

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to knveraraju91

2 weeks ago

Try it again?

I get an exact match when I run your program.

Is your program a simplification of the original circumstances?

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Astounding

2 weeks ago

Thank you very much for the reply.

The values are not matching in my actual comparison.

But the values are matching if copy the same values into one and two data sets.

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to knveraraju91

2 weeks ago - last edited 2 weeks ago

if you examine the values with a different format such as 24.8 you might very well see a difference. The format will round values to display them within the limits of the stated characters.

When you place them into a data set that way you are providing a rounded value that is identical when read so that has no bearing on the values of the variables in the other data set.

PROC COMPARE has the CRITERION and METHOD options that will set different rules determining equality.

You should show the code you were using to compare the values. There are a number of ways where small differences can be set to be considered equal if needed but depend on the comparison used.

Here is an example of two values that are not equal but "appear" equal when a format is applied.

data example; x= 12345678910.123; y= 12345678910.456; run; proc print data=example; format x y best8.; run;

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to knveraraju91

2 weeks ago

I get the same results that @Astounding got:

```
data one;
input seq;
datalines;
5.354E14
;
run;
data two;
input seq1;
datalines;
5.354E14
;
run;
proc compare base=one compare=two;
VAR seq;
WITH seq1;
run;
```

SAS Output

Number of Observations in Common: 1. Total Number of Observations Read from WORK.ONE: 1. Total Number of Observations Read from WORK.TWO: 1. Number of Observations with Some Compared Variables Unequal: 0. Number of Observations with All Compared Variables Equal: 1. |

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to knveraraju91

2 weeks ago

You can use the FUZZ option, to specify what level of detail you want. Note the results there say the error is really really low,

-3.73E-10

Which is 0.000000000373.

So you can set FUZZ to mask errors less than 0.01.

```
proc compare base=one compare=two fuzz=0.01;
run;
```