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: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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