There is no Adverse Event reported on Adverse Event Form where
AE.AEDIS = YES
If atleast in any of the logline aedis=yes then it should not fetch in the output. Can anyone suggest a solution?
Please post data in usable form so that we have something to work with. Also show what you expect as output.
logic: DS.DSDECOD = Adverse Event
AND
There is no Adverse Event reported on Adverse Event Form where
AE.AEDIS = YES
subject aedis dsdecod
1001 Yes Adverse event
1001 blank Adverse event
1001 no Adverse event
Like above example, a subject has 3 loglines and in one of the logline it is present as aedis=yes , so this subject should not come in output.
code for this ??
When posting data make sure that
Idea to solve the problem:
proc sql noprint;
create table work.want as
select * from work.adverse_events
where subject not in (select subject from work.aedis)
;
quit;
Code is, of course, untested. Using a single step with two dow-loops seems to be the better approach, as less iteration are required.
In the absence of sample data in the form of a working data step, the code below is untested.
Assuming your data is in a dataset named HAVE and the data is sorted by subject, then:
data want;
merge have (where=(dsdecod='Adverse event') in=unwanted)
have ;
by subject;
if unwanted=0;
run;
Is this one of those questions where ALL of the values for single person has to be considered?
If so you need to state such before getting into any coding. SAS data steps where any such code is likely to be used processes data sets one observation at a time. If something has to consider more than one observation for a 'correct' answer than that criteria has to be explicitly stated and described properly to implement.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.