DATA Step, Macro, Functions and more

Format problem

Posts: 45

Format problem

[ Edited ]



I have a table t1 with two dates d1 and d2. I need to have the year difference in decimals (2decimals).

I do:


format yr 15.2;
yr= INTCK('month',d1, d2)/12;



Following this, I join with another table t2 on the number of years (with two decimals).

But it can't match except when the year t1 has  decimals like






It doesn't want to match when it is decimals like










The common points of all is they are rounded to the second decimal calculations (*.33 is in fact *.33333333... whereas for table t2 it is truely *.33)


Do you know what I have to do in order to match them?


Thanks for answer.

Super User
Posts: 10,588

Re: Format problem


yr = round(yr,.01);

to round up to the second fractional digit.

Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation