I'm attempting to filter out records that contain specific words within a string for the REASON_FOR_VISIT
variable. I then want to use the remaining records to compute the median values for the variable total_ed_los
and arrive_to_dr_sees
.
I have the following code but I'm afraid that it's not filtering out the strings I would like it to. Is this an instance I need to use PROC SQL
or are there other options?
Thanks!
data FT_Post;
set WORK.FT_May;
Where checkin_time between '12:00't and '20:00't;
Where REASON_FOR_VISIT Not Like '%psyc%';
Where REASON_FOR_VISIT Not Like '%psy eval%';
Where REASON_FOR_VISIT Not Like '%psych%';
Where REASON_FOR_VISIT Not Like '%suicid%';
Where REASON_FOR_VISIT Not Like '%homicid%';
run;
proc means data=FT_Post median;
class checkin_date;
var total_ed_los arrive_to_dr_sees;
run;
If you have multiple 'vanilla' where clauses in a datastep you will see the following in the log:
To avoid this behaviour, you can use
where also
:You will now see: