data stroke_onset;
set EVT.stroke_ischemic;
where SP340_ONSET IS NOT MISSING;
where FIRST_ADM_TM>SP340_ONSET;
by CIHI_KEY_DAD FIRST_ADM_TM;
Window1=(FIRST_ADM_TM-SP340_ONSET)/60;
length cat $100.;
if 0<=Window1<=360 then cat="0to6";
else if 360<Window1=<1440 then cat="6to24";
else if 1440<Window1 then cat = ">24";
else if missing (SP340_ONSET) then cat = "Stroke onset time missing";
else if FIRST_ADM_TM<SP340_ONSET then cat = "Stroke onset after First Admit Time";
else cat='NA';
run;
Hello Can someone advise how I would write the above code i.e. using either the where or if clause to exclude the observations from the output for the bolded categories
What I have stated in the if then conditions is what I want but now I want to exclude those observations from the output
Also did not want to combine the two where conditions using the and operator since I want to exclude observations for each condition applied separately. Do ijust use subsetting if statements
WHERE applies to source data.
if you want to delete reservations based on if/assignment statements, you can include a DELETE statement, or an explicit OUTPUT for those observations you wish to save.
WHERE applies to source data.
if you want to delete reservations based on if/assignment statements, you can include a DELETE statement, or an explicit OUTPUT for those observations you wish to save.
Only the last where condition will take effect, so you need to combine both into one with "and".
Once that is done, the two bold else-if are not necessary any longer.
if I include it using the an in the where then i am not getting the right result as both conditions are applied togetther whereas i wanted to apply both conditions seperately on the source data
Thankyou
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.