×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

How many records for the same persion in a given time period?

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!

RE: How many records for the same persion in a given time period?

There are different ways to do it - but I'd say NO to the do loop.  I'd create new variables (based on your date field) for yr and wk (and possibly a combo yr-wk depending on if you need it).  Then Proc Summary.

RE: How many records for the same persion in a given time period?

Simple Data Step can also do
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/
 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close