BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sasuser123451
Calcite | Level 5

Hi,

I am trying to determine therapy utilization rate based on the way that we have defined therapy use - ie within 180 days of diagnosis of the disease. I am trying to find a way to assign each ID (enrolid) its own denominator based on the number of people who were eligible for therapy at that time. 

 

Variables involved here: enrolid, index_date (date of diagnosis of the disease), and svcdate (date that therapy was received). So for each enrolid, I would compare the date of therapy (svcdate) to the date of diagnosis (index_date) for all other enrolid's and want to get a sum of all enrolids whose date of diagnosis (index_date) was within 180 days prior to the date of therapy. 

 

enrolid        index_date         svcdate           denominator

123             2/1/2011             3/12/2011           ?

456             10/1/2012           11/4/2012           ?

789             1/1/2011             3/6/2011             ? 

 

So here, the denominator for enrolid #123 would be 2, because enrolids 123 and 789 both have index_dates that are within 180 days (6 months) prior to the svcdate for enrolid #123. Same thing for enrolid #789. The denominator for enrolid #456 would be 1 because it is the only enrolid with an index_date within 180 days of its svcdate. There is only one observation per enrolid. 

 

I know this syntax is not correct (I do not know how to reference the variable of the observation we are currently looking at vs the variable from a different observation we are comparing to), but this is the general idea of what I am thinking:

data want; set have; 
retain denominator 1 denominator_;
*setting denominator as one because each enrolid counts for its own denominator;

do while enrolid NE enrolid;               
**wrong syntax, but do while the enrolid of the observation we are comparing is not equal to the current enrolid ie compare to all other observations;

if intck('day',index_date,svcdate) > 0  and intck('day',index_date,svcdate) LE 180     
**wrong syntax, but compare this observation's svcdate to index_date of other observations;
*so I would want the svcdate to be the svcdate for the current observation and index_date to be the index_date for the observation we are comparing to;

then denominator+1; 
                                     
else denominator=denominator;

end;
run;


I am using SAS Enterprise Guide 8.1.

 

Thank you!

1 ACCEPTED SOLUTION
2 REPLIES 2
sasuser123451
Calcite | Level 5

This code worked perfectly and accomplished exactly what I needed to accomplish. Thank you so much for your help, Kurt!

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
  • 2 replies
  • 606 views
  • 1 like
  • 2 in conversation