### sas >> Difference between two numbers

Hi,

I have a tricky problem. Lets say i have a number which is 123456 and
another which is 123465. The subtle difference here is that the 65 is
the reverse of 56 (last two digits of both numbers). Is there a SAS
function which gives me an idea as to how similar these two numbers
are - or perhaps that the numbers are the same but in a different
order?

Many thanks,
H

### sas >> Difference between two numbers

The Compcost call routine allows you to define the "cost" of matches,
which you can then use in the compged function to calculate edit
distances.

In your case you probably want to set swap to a cost of 0, all matches
that contain the same characters will therefore not have a cost. You
can also tinker with the insert / delete costs and others to your
hearts content.

http://support.sas.com/documentation/cdl/en/lrdict/59540/HTML/default/a002206135.htm

data test;
input (val1 val2)(\$) @@;
if _n_=1 then call compcost('swap=',0);
similarity=compged(val1, val2);
cards;
1234 1234 1234 1243 1234 1223 1332 2222
;run;
proc print;run;

Obs val1 val2 similarity

1 1234 1234 0
2 1234 1243 0
3 1234 1223 200
4 1332 2222 300

2008/11/24 < XXXX@XXXXX.COM >:

### sas >> Difference between two numbers

Try the complev function.

data test;
input (val1 val2)(\$) @@;
similarity=complev(val1, val2);
cards;
1234 1234 1234 1243 1234 1223 1332 2222
;run;
proc print;run;

The SAS System 14:55 Monday,
November 24, 2008 1

Obs val1 val2 similarity

1 1234 1234 0
2 1234 1243 2
3 1234 1223 2
4 1332 2222 3

```Hi,

can anyone tell me how to convert the difference between two dates to exact months ?

Help would be appreciated!! :)
Thanks,

Regards,
Hema

---------------------------------
Low, Low, Low Rates! Check out Yahoo! Messenger's cheap  PC-to-Phone call rates.
```

```Hi,
I have a rather simple problem, but cannot get it done. I just want to
compute the difference in days between two SAS date variables (DATEVAR1
and DATEVAR2). SAS says, DATEVAR1 has ddmmyy9. and DATEVAR2 has
DATETIME20. format.
DATEVAR1       DATEVAR2          The result could look like DIFFDAY
24/11/97      25NOV1997:00:00:00                          1
14/12/00      16DEC2000:00:00:00                          2
17/02/00      21FEB2000:00:00:00                          4
17/07/00      10DEC1999:00:00:00                          etc.
29/09/00      09DEC1999:00:00:00
...