BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
michtka
Fluorite | Level 6

Hi guys, I got the next problem:

*Because I dont have AE collected by day (colldate) in the dataset ae, we need to assign AE to the collection date (colldate) from a dataset called drugs;

1) in the below code I can assign the AE: start AE (aefdate) <= colldate and stop AE (aetdate) <= colldate

      proc sql noprint;
        create table symptomx as
        select ae.pid, ae.aefdate,ae.aetdate, ae.prefcode, ae.preftext, ae.aercaus,ae.aecaus, a.colldate,
        a.factdat,a.lactdat,a.cpevent,a.visit
        from ae
        left join drugs a
        on ae.pid=a.pid
        and ae.aefdate le a.colldate le ae.aetdate;
      quit;

2) My problem is that I need to assign also AEs that stop before the colldate, i.e the condition ae.aetdate le a.colldate

Is possible to add this extra condition to the above proc sql code, or I need to create another proc sql table?

Thnaks.

V.

1 ACCEPTED SOLUTION

Accepted Solutions
never
Calcite | Level 5

I'm not sure I completely understand your problem... but i think this is what you're looking for...

      proc sql noprint;
        create table symptomx as
        select   ae.pid,

                    ae.aefdate,

                    ae.aetdate,

                    ae.prefcode,

                    ae.preftext,

                    ae.aercaus,

                    ae.aecaus,

                    a.colldate,
                    a.factdat,

                    a.lactdat,

                    a.cpevent,

                    a.visit
        from ae left join drugs a
             on ae.pid = a.pid
        where ae.aefdate le a.colldate

                    and  a.colldate le ae.aetdate

                    and ae.aetdate le a.colldate ;
      quit;

If not, can you clarify what all these things are... perhaps tell me what AE means for context.

View solution in original post

1 REPLY 1
never
Calcite | Level 5

I'm not sure I completely understand your problem... but i think this is what you're looking for...

      proc sql noprint;
        create table symptomx as
        select   ae.pid,

                    ae.aefdate,

                    ae.aetdate,

                    ae.prefcode,

                    ae.preftext,

                    ae.aercaus,

                    ae.aecaus,

                    a.colldate,
                    a.factdat,

                    a.lactdat,

                    a.cpevent,

                    a.visit
        from ae left join drugs a
             on ae.pid = a.pid
        where ae.aefdate le a.colldate

                    and  a.colldate le ae.aetdate

                    and ae.aetdate le a.colldate ;
      quit;

If not, can you clarify what all these things are... perhaps tell me what AE means for context.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

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
  • 1 reply
  • 853 views
  • 0 likes
  • 2 in conversation