BookmarkSubscribeRSS Feed
Chandanat17
Calcite | Level 5

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?

5 REPLIES 5
andreas_lds
Jade | Level 19

Please post data in usable form so that we have something to work with. Also show what you expect as output.

Chandanat17
Calcite | Level 5

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 ??

andreas_lds
Jade | Level 19

When posting data make sure that

  • you post the data as working data step code
  • and that all cases that exist in your real data are present at least once.

Idea to solve the problem:

  • create a dataset containing all obs with "Adverse event"
  • use that dataset to create another one having only those obs with aedis = "Yes"
  • finally something like this:
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.

mkeintz
PROC Star

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;

 

 

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
ballardw
Super User

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.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 475 views
  • 1 like
  • 4 in conversation