Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • 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!

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

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...Within the first afternoon I found 2 of the 3 needed solutions, and the 3rd came to me over the weekend!..."

Geography

Where in the world do Tek-Tips members come from?
sarpham (Instructor)
18 Aug 09 14:16
I'm hoping there are some SPSS syntax programmers out here! I'll try to keep this short:

I have a data set with about 1.5 million people. The data set contains their prescription drug records from 2006. The data is set up this way:

Subj begin1 stop1 begin2 stop2...etc
1 1/12/06 2/24/06 1/30/06 3/28/06
1 2/25/06 3/29/06
1 3/30/06 4/20/06 5/15/06 6/15/06
2 1/20/06 3/20/06
2
2
2
3
4
etc

where begin1 stop1 = the start & end dates of class 1 type of drug (there are 25 classes).

I need to create 3 new binary variables to reflect the amount of overlap in class of drug(30 days, 60 days, 90 days). Here is the macro I am working with:

DEFINE !OVLAP25 ().
!do !i=1 !to 24
!do !j=!i !to 25
!if (!j>!i) !then
compute #begin =max(!concat(begin,!i), !concat(begin,!j)).
compute #stop=min(!concat(stop,!i), !concat(stop,!j)).
if (#begin<#stop) #overlap25 =ctime.days(#stop-#begin).
if (#overlap25>=30) overlap25_30 =1.
if (#overlap25>=60) overlap25_60=1.
if (#overlap25>=90) overlap25_90=1.
!ifend.
!doend.
!doend.
exec.
!ENDDEFINE.

!OVLAP25.

The issue is, I need to make sure that the only overlap is within subject (e.g. overlap within subj = 1, within subj = 2, etc). Right now, it assess any overlap at all, regardless of subj #.

Is there a way to do this? Aggregate? Any help would be greatly appreciated!!!

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!

Back To Forum

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