BookmarkSubscribeRSS Feed
sneha_dodle
Fluorite | Level 6
I need to find overlapping advevent value for the same patid and date.
This is the dataset i have:
Patid advevent date
1 vomiting 01jan09
1 vomiting 01jan09
1 vomiting 01jan09
2 delirium 06jan09
2 nausea 06jan09
2 delirium 06jan09
2 delirium 06jan09

My outpout should be

2 delirium 06jan09
2 nausea 06jan09
7 REPLIES 7
PaigeMiller
Diamond | Level 26

Please explain further. Why are those two records the only output? What is the logic that keeps those two lines and not the others?

--
Paige Miller
sneha_dodle
Fluorite | Level 6
My task to create a dataset that contains observations with different
advevent value for the same patid and visitdate.
Im creating an outliers dataset. A single patient cannot have two
different adverse events at the same visit date.
Astounding
PROC Star

I would recommend you go back and check on the task you were given.

 

It is certainly possible for a patient to have more than one adverse event on the same day.  It would be unusual to be allowed to report only one.

 

It is unusual for a patient to report the same adverse event multiple times on the same day.  If a patient reports 3 headaches on the same day, they would usually be treated as a single headache.

PaigeMiller
Diamond | Level 26

This does not address my earlier question: "Why are those two records the only output? What is the logic that keeps those two lines and not the others?"

 

Specifically, why are there no output records for Patid 1?

--
Paige Miller
sneha_dodle
Fluorite | Level 6
Ive given only a sample of my dataset. i have patid values that go upto 244 and 4 to 6 advevent values for each patid
Shmuel
Garnet | Level 18

Without entering, is the query logic or not, I assume that next code may give you the requested result:

proc sort data=have out=temp nodupkey;
  by patid date advevent;
run;

data want;
set temp;
   by patid date advevent;;
        if not (first.date and last.date);
run;
s_lassen
Meteorite | Level 14

Here is an SQL solution:

proc sql;
  create table want as
  select distinct Patid, advevent,date from have
  group by Patid, date
  having count(distinct advevent)>1;
quit;

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 1823 views
  • 0 likes
  • 5 in conversation