I had no success with both approaches. I believe my problem lies in the format of the START and END variables which Proc Content indicates are in $N8601E. format. When I run the following code, I get errors stating Variables "START" (and "END") has already been defined as a numeric. I tried changing the format of START and END but I always get the same error. If I try changing the format of the START and END to YYMMDD. or any Numeric format, the values just disappear. Nevertheless, this code works if I use date variables with original format YYMMDD. in place of START and END. data want; length DURATION $16; call is8601_convert('dt/dt','du',START,END,DURATION); format DURATION $N8601E.; set have; run; Anyways, after trying different things, I found that the following code works perfectly with START and END in $N8601E. format even though I thought that using the INPUT function, the format indicated should be the format of the original variable, not the new variable... anyway, this works... data want; set have; STARTN=input(START, IS8601DA.); ENDN=input(END, IS8601DA.); DURATION=DATDIF(STARTN,ENDN,'actual'); run; output: START END DURATION 2011-11-21T11:15 2012-02-08T08:15 79 2011-12-14T11:35 2012-03-05T09:45 82 2012-04-13T11:00 2012-07-05T10:00 83 2012-04-16T09:40 2012-07-04T05:40 79
... View more