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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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