Calculating days between multiple date variables.

Reply
N/A
Posts: 1

Calculating days between multiple date variables.

Hello everyone,

I'm very new to using SAS and getting my head around the basics.

I'm working with a column which gives the dates of when our customers have made return visits. My aim is to be able to calculate how many days have lapsed between each of their recorded visits, and then find the average amongst all of those. Bearing in mind that I will need to do this for multiple customers, sorting by their customer account number.

Any help would be appreciated.

Super Contributor
Posts: 349

Re: Calculating days between multiple date variables.

Hi,

It would be helpful ,if you can share some sample data.

Thanks,

Shiva

Trusted Advisor
Posts: 1,129

Re: Calculating days between multiple date variables.

Hi,

Possibly you can use intck function which returns the days, years and month, depending upon your requirement. Please check the below code.

data have;

input id visit1 : date9. visit2 : Date9.;

diff=intck('day',visit1,visit2);

cards;

101 24dec2011 25jan2012

102 10dec2011 01jan2012

;

run;

Thanks,

Jag

Thanks,
Jag
Ask a Question
Discussion stats
  • 2 replies
  • 206 views
  • 0 likes
  • 3 in conversation