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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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