BookmarkSubscribeRSS Feed
Student77
Obsidian | Level 7

Hello,

 

I am working with insurance claims data (opioid study) and I am trying to limit my cohort to long-term opioid users. n= ~12 million (records) 

I am defining "long-term use" as having had a total of 90+ days of prescription opioids in the 365 days prior to an index date.

 

The data includes multiple records, eligibility start and end dates, drug names, my index date, patient ID and others not really relevant to this.

 

I have no idea where to start, but what I thought to do is first determine those with continuous enrollment in the 365 days before index, so:

 

Data longterm; set all;

prior = (index_date) - 365; 

if elig_begin <= prior <= elig_end then consecutive=1;  
else consecutive-0;

*not sure about this? trying to make sure that the full 365 days before index, that a person had insurance coverage;

*now with indicator for the 365 days before index, I want to select those patients who had 90 days (total - does NOT have to be consecutive, but insurance enrollment must be consecutive in that time to be able to accurately capture prescriptions in that time);

proc sql;

select ?

I have the list of all possible drug names to select the 90 days use from, but not sure how to code this. I am sorry, it was simpler in my head when I took on this project!

 

Thanks

 

1 REPLY 1
ballardw
Super User

Best, when practical, is to provide a small example data set and what you expect the result to look like. The data should be in the form of data step code.

 

Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the <> icon or attached as text to show exactly what you have and that we can test code against.

 

Some tasks, especially sequentially related processing, are often better done with data step code as order of processing can be enforced. The structure of your data set also can have a great impact on what can be done and your date might require reshaping or additional variables.

 

Please provide only information needed to do requested tasks. Identification likely should be included but generic 1, 2, 3 values instead of real identifiers would work.

 

There are multiple ways to use something like a drug list. The questions become things like "does it have to be the same drug the entire period of interest" or "any of the drugs at all during the period of interest".

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 431 views
  • 0 likes
  • 2 in conversation