- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
then do I write the code as below:
else if missing (SP340_ONSET) then output Stroke onset time missing;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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