12-29-2017 03:09 PM
I have a list of inpatient claims ("compiled_ip_index_1") where all enrolids are confirmed to be continuously eligible. Dataset also includes the following vars:
How do I exclude all claim entries from a specific enrolid-year combination if a series of exclusionary codes happen to that enrolid-year after index date?
I'm thinking of something like the following. Haven't tested it out -- is there any way to make this more elegant? Is the below syntax OK?
%let excl_code = '123', '12345', '4567', '1859', '9084' data excluded_enrolid_year; set compiled_ip; keep enrolid year; where dx1 in &excl_code and dtstart >= index_dt; run; data final_compiled_ip; set compiled_ip_index_1; drop select distinct enrolid, year from excluded_enrolid_year;
Thank you so much! (the last part def2=1 I just want to flag that these entries qualify under "def 2")
12-29-2017 06:17 PM
Why haven't you tried your code? That would be the logical thing to do before posting to this forum.
From my partial understanding of your requirements, your code should be:
%let excl_code = ('123' '12345' '4567' '1859' '9084'); data excluded_enrolid_year; set compiled_ip; keep enrolid year; where dx1 in &excl_code. and dtstart >= index_dt; run; proc sql; create table final_compiled_ip as select * from compiled_ip_index_1 as a where not exists (select * from excluded_enrolid_year where enrolId=a.enrolId and year=a.year); quit;
Could also be done with a merge operation in a data step, I guess.
12-29-2017 06:47 PM