How many records for the same persion in a given time period?
How many records for the same persion in a given time period?
(OP)
Hi,
I have a SAS data set with some 2 million records.
The records span a period of 5 years.
Many records are representative of the same person.
Each record has a variable for a service date.
I need to find out how many people have records with more than one service date in a seven day period, as well as how many people have multiple records in a one year period.
How can I do this? Would I use a Do loop command?
thanks!
I have a SAS data set with some 2 million records.
The records span a period of 5 years.
Many records are representative of the same person.
Each record has a variable for a service date.
I need to find out how many people have records with more than one service date in a seven day period, as well as how many people have multiple records in a one year period.
How can I do this? Would I use a Do loop command?
thanks!
RE: How many records for the same persion in a given time period?
RE: How many records for the same persion in a given time period?
1. Take original dataset worted with PersonID, Service date
2. Take 3 new variables last_serv_dt, wk_tot and yr_tot and reatin those variables
3. Use First. and last. on person ID
4. if service_date - last_serv_dt <7 then wk_tot+1
5. if year(last_serv_dt) eq year(service_date) then yr_tot +1
After this you can get the totals of week and year
that is wk_tot and yr_tot
sasbuddy
http://sites.google.com/site/sasbuddy/