@sas_sad wrote:
No, but it does not give me difference in days between diagnosis date and lab test date.
How can you tell? What do you get it you use PROC MEANS to look a the min/max/mean of your new calculated variable?
Look at your original dataset. How are those two "date" variables defined.
Since you didn't get any message about converting characters to number then the two variable are numeric. But what types of values do they contain. SAS stores dates as the number of days since 1960. To make the number look readable to humans you need to attach for format like DATE or YYMMDD to the variable.
Some people create "date" variables that actual contain a datetime (or timestamp) value instead. SAS stores those as the number of seconds since 1960. If you want to calculate the number of days between two datetime values with INTCK() you need to use the DTDAY interval and not the DAY interval. If one is DATE and the other is DATETIME then you need to convert one of them before comparing them.
Sometime people also create numeric variables with integer values like 20,210,721 and think those are date because they look like YYYYMMDD values when printed.