BookmarkSubscribeRSS Feed
knveraraju91
Barite | Level 11

Dear,

 

In my AE data the folowing information is given.

 

ID    PERIOD      DOSE     AEREL                                 TRTEMFL

1         1                 25        RELATED                                  Y

1          2                25        

2         1                 50         RELATED                                 Y

2          2                50                   

3          1                25          

4          1                25

5           1                50

6           1                25           RELATED                               Y

7           1                 25          NOTRELATED                        Y

8            1               25               

 

 

OUTPUT NEED

 

                                                  Period1

                                    ______________________

                                      75                                 50

NS %                              N=6                              N=2   

ANY TEAE                     3(50)                              1(50)

     Related                     2(33.3)                           1(50)

 

My code;

 

proc sql;
create table TotalNS as
select count(distinct usubjid) as NS
from data1
where dose =25 and period=1;
quit;

 


proc sql;
create table one as
select count(distinct usubjid) as NS
from adae
where trtemfl='Y' and dose =25 and period=1; ;
quit;

 

proc sql;
create table three as
select count(distinct usubjid) as NS
from adae
where trtemfl='Y' and dose =25 and period=1 and arel='RELATED';
quit;

 

 

I created these three datasets and merged the them. Is there any way  I can simplify my code and calculate all in one.  There are several doses inaddition to 25 and 50 to calclate.

Thanks

 

1 REPLY 1
Reeza
Super User

You should provide your data as a data step, not just text 🙂

 

I don't think you can via SQL, but you probably can via a data step. 

 

The count distinct does make it a bit harder, but try using BY GROUPS with First/Last logic to do counts. Or even proc freqs if you structure your data correctly - mainly so you only have one per person.

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
  • 817 views
  • 0 likes
  • 2 in conversation