data have;
input
ID
Date :mmddyy10.;
format date mmddyy10.;
cards;
1
11/12/18
1
11/20/18
1
11/28/18
3
6/4/18
3
6/20/18
;
data want;
set have;
by id;
DiffDate=dif(date);
if first.id the DiffDate=.;
run;
data have;
input
ID
Date :mmddyy10.;
format date mmddyy10.;
cards;
1
11/12/18
1
11/20/18
1
11/28/18
3
6/4/18
3
6/20/18
;
data want;
set have;
by id;
DiffDate=dif(date);
if first.id the DiffDate=.;
run;
Catch up on SAS Innovate 2026
Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.