I have ID numbers with the date of purchase: ID Number Purchase Date and Time 1234 01OCT2008:10:00:13 1234 09SEP2009:16:00:23 1234 14MAY2012:10:00:27 567 07JAN2009:16:00:20 789 .... 789 234 234 234 And so on and so forth. I want to loop through the purchase date and time by ID numbers and count the number of days between the purchase date. So basically I want to ask " How many days ago did the same person make that purchase. So I want a count of days between first record and second, then the second and third for each ID number. My code isn't that great now, DATA COUNTS1; SET SUMMARY; BY ID_NUMBER; FIRST_DATE= DATEPART(FIRST.PURCHASE_DATE); END_DATE = DATEPART(LAST.PURCHASE_DATE); DO I= FIRST_DATE TO END_DATE; DAYS= INTCK('DAYS',FIRST_DATE,END_DATE); OUTPUT; END; PUT DAYS; RUN; New to SAS, so please help me out.
... View more