BookmarkSubscribeRSS Feed
Asboaheng
Fluorite | Level 6

Hi all, I need your help in selecting patients with four or more asthma prescriptions within a 12 month rolling period. I have the first column as patient ID, the second column as the Drug identification number (DIN), the third column as the date (yyyymmdd). Any help or assistance will be greatly appreciated. Thank you.

7 REPLIES 7
Reeza
Super User
It helps if you provide sample data, fake data is 100% fine, just mock it up in Excel and paste it in if you need.
Asboaheng
Fluorite | Level 6

Thank you. Please find attached the data I have created as requested.

PatientIDDrug IDFill Date
122441998-01-01
222351998-01-02
322761998-01-03
222661998-01-04
222441998-01-05
122331998-05-09
122761998-05-10
122551998-05-11
233441998-05-12
233441998-05-13
323451998-05-14
312341999-08-16
366771999-08-17
333441999-08-18
444441999-08-19
444441999-08-20
433331999-08-21
588991999-08-22
588991999-08-23
633441999-08-24
622441999-08-25
727891999-08-26
898091999-08-27
812341999-08-28
812341999-08-29
812451999-08-30
913891999-08-31
978701999-09-01
ballardw
Super User

 

'Same asthma prescription" or "any asthma prescription"? Considerably different problems, especially with the plethora of drug codes out there.

Depending on which version of a drug code you have the same drug may have different code as at least one of the code schemes includes manufacturer information.

Asboaheng
Fluorite | Level 6

Any asthma prescription. It could be the same drug prescribed at different dates within a year or different drugs prescribed to a patients within a year.

mkeintz
PROC Star

"12 month rolling period".   So how do you want the rolling 12-month windows in the output?  Do you want an observation for every 12-month window in a patient's history (presumably with some sort of drug count for each window)? 

 

Or do want an observation only for every 12-month window with 4 or more drugs?   And if the answer is yes, then  do you want one observation for every window that qualifies?  I.e. if a patient uses drugs in Feb 99, Apr 99, Jun 99, Aug 99, then conceivably there are 8 qualifying windows   (from  Jul 1998-Jun 1999    through Feb 1999-Jan 2000).

 

It would be good to show what the output data would look like for the sample input data you provided.

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
Asboaheng
Fluorite | Level 6

Yes, I want an observation only for every 12-month window (or within a year) with 4 or more drugs?.

Reeza
Super User
Do you care what drug? Or do you just need the list of IDs? As indicated by MKeintz, it would be ideal if you could show the expected output from your sample input.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 7 replies
  • 738 views
  • 0 likes
  • 4 in conversation