BookmarkSubscribeRSS Feed
macro_2349
Calcite | Level 5

Hello,
This is the data I have:

 

idstudy_strtstudy_enddrugnamedrugtyperx_datedays_splydrug_startrx_end
12008-09-262010-09-26DrugA22008-10-1330172008-11-12
12008-09-262010-09-26DrugA22008-10-2330272008-11-22
22012-08-232014-08-23DrugB12012-08-254522012-10-09
22012-08-232014-08-23DrugA22012-08-254522012-10-09


Data I want would look like this:

idstudy_strtstudy_enddrugnamedrugtyperx_datedays_splydrug_startrx_enddiscontinue
12008-09-262010-09-26DrugA22008-10-1330172008-11-120
12008-09-262010-09-26DrugA22008-10-2330272008-11-220
22012-08-232014-08-23DrugB12012-08-254522012-10-090
22012-08-232014-08-23DrugA22012-08-254522012-10-091


Ideally I would like to keep my data in long form while identifying different medication treatment patterns. Medication discontinuation is defined as a gap of 30 days or more within the study period where there is no record of prescription. Any tips on how I can create an dichotomous variable called discontinue, where 0 = no discontinuation and 1 = discontinuation.

rx_date = date prescription is filled
drug_start = day in study period in which prescription was filled


Many thanks in advance!




 

2 REPLIES 2
ballardw
Super User

Please state explicitly the rule(s) involved in creating that dichotomous variable Discontinue.

 

It helps greatly to be consistent in code and data description. Your "have" data does not have a variable named "drugname" but that is used in your code.

 

Examples are nice but do not necessarily provide rules to handle cases other than what is shown.

 

Are you assuming the rx_date is the date a prescription is filled? What exactly does "drug_start" represent?

 

I am not clear exactly what you mean by " modify to create dichotomous indicator variable (0/1) rather than output dataset?".

 

macro_2349
Calcite | Level 5
Thank you. I have modified my original post to answer your queries. Please let me know if you require further clarification.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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
  • 2 replies
  • 507 views
  • 0 likes
  • 2 in conversation