SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
zimcom
Pyrite | Level 9

 

Dear Community,

I am quite new to SAS programming and has been learning and using SAS to clean and manipulate data for about 2 months (thanks to the great and generous help I got from this forum) and now I want to challenge myself to learn tabulating summary reports (Example 1, 3 and 4 in the attached paper). Below is a simple example I found on internet:

 

 

0verall N=70

 

------

------------

System Organ Class

 

Subject

Preferred Term

Event

n(%)

---------------------------------------------------------

Overall

20

14(20)

Cardiac disorders

6

4 (6)

Atrial flutter

1

1 (1)

Cardiac failure

1

1 (1)

Palpitations

3

2 (3)

Tachycardia

1

1 (1)

 

This example above was written in SAS Macro, which seems very complicated to me for now and I plan to learn later when I have had more experience. For now, I just want to try to use SAS code to generate the summary above. The Marco codes in the attached abstract is too hard to follow now.

For those not familiar with clinical trial data, I have a data set consisting variables like subject id, aeterm, preferred term and system organ class (SOC) of thousand observation, which I would like to turn the data into the summary table like above.  Below is the part of the data

usubjid

aeterm

preferred term

aebodsys

1002

aspiration pneumonitis

Pneumonia aspiration

Respiratory, thoracic and mediastinal disorders

1002

Epistaxis

Epistaxis

Respiratory, thoracic and mediastinal disorders

1003

ischemic stroke

Ischaemic stroke

Nervous system disorders

1007

Multiple Myeloma

Plasma cell myeloma

Neoplasms benign, malignant and unspecified (incl cysts and polyps)

1007

Dehydration

Dehydration

Metabolism and nutrition disorders

1007

Worsening Pleural Effusions

Pleural effusion

Respiratory, thoracic and mediastinal disorders

1011

Orolingual angioedema

Angioedema

Skin and subcutaneous tissue disorders

1011

Worsening of Congestive heart failure

Cardiac failure congestive

Cardiac disorders

1011

Pneumonia

Pneumonia

Infections and infestations

1012

Recurrent Stroke

Cerebrovascular accident

Nervous system disorders

1013

Right femoral pesudoaneurysm

Vascular pseudoaneurysm

Injury, poisoning and procedural complications

1016

Malignant MCA infarction (Index Stroke)

Ischaemic stroke

Nervous system disorders

1018

Progression of Stroke

Stroke in evolution

Nervous system disorders

1021

Acute Coronary Syndrome

Acute coronary syndrome

Cardiac disorders

1026

Progression of Ischemic Stroke

Stroke in evolution

Nervous system disorders

 

Any help would be greatly appreciated!

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
zimcom
Pyrite | Level 9

@FreelanceReinh

Thanks for your reply.

I am working in a smal biotech company, there are no previous SAS code examples to follow. The clinical trial we are currently running is a blinded study and so I will have to change/update the Marco code in order to fit our situation.

 

Thank you very much again!

 

View solution in original post

5 REPLIES 5
zimcom
Pyrite | Level 9

Thank you !!

Reeza
Super User

@zimcom wrote:

 

Dear Community,

I am quite new to SAS programming and has been learning and using SAS to clean and manipulate data for about 2 months (thanks to the great and generous help I got from this forum) and now I want to challenge myself to learn tabulating summary reports (Example 1, 3 and 4 in the attached paper). Below is a simple example I found on internet:

 

 

0verall N=70

 

------

------------

System Organ Class

 

Subject

Preferred Term

Event

n(%)

---------------------------------------------------------

Overall

20

14(20)

Cardiac disorders

6

4 (6)

Atrial flutter

1

1 (1)

Cardiac failure

1

1 (1)

Palpitations

3

2 (3)

Tachycardia

1

1 (1)

 

This example above was written in SAS Macro, which seems very complicated to me for now and I plan to learn later when I have had more experience. For now, I just want to try to use SAS code to generate the summary above. The Marco codes in the attached abstract is too hard to follow now.

For those not familiar with clinical trial data, I have a data set consisting variables like subject id, aeterm, preferred term and system organ class (SOC) of thousand observation, which I would like to turn the data into the summary table like above.  Below is the part of the data

usubjid

aeterm

preferred term

aebodsys

1002

aspiration pneumonitis

Pneumonia aspiration

Respiratory, thoracic and mediastinal disorders

1002

Epistaxis

Epistaxis

Respiratory, thoracic and mediastinal disorders

1003

ischemic stroke

Ischaemic stroke

Nervous system disorders

1007

Multiple Myeloma

Plasma cell myeloma

Neoplasms benign, malignant and unspecified (incl cysts and polyps)

1007

Dehydration

Dehydration

Metabolism and nutrition disorders

1007

Worsening Pleural Effusions

Pleural effusion

Respiratory, thoracic and mediastinal disorders

1011

Orolingual angioedema

Angioedema

Skin and subcutaneous tissue disorders

1011

Worsening of Congestive heart failure

Cardiac failure congestive

Cardiac disorders

1011

Pneumonia

Pneumonia

Infections and infestations

1012

Recurrent Stroke

Cerebrovascular accident

Nervous system disorders

1013

Right femoral pesudoaneurysm

Vascular pseudoaneurysm

Injury, poisoning and procedural complications

1016

Malignant MCA infarction (Index Stroke)

Ischaemic stroke

Nervous system disorders

1018

Progression of Stroke

Stroke in evolution

Nervous system disorders

1021

Acute Coronary Syndrome

Acute coronary syndrome

Cardiac disorders

1026

Progression of Ischemic Stroke

Stroke in evolution

Nervous system disorders

 

Any help would be greatly appreciated!

Thanks


L
Search for the paper, creating complex reports via Cynthia Zender, @Cynthia_sas

You can also look at PROC REPORT. 

 

To be honest, you can get pretty close using just PROC FREQ. 

 

 

zimcom
Pyrite | Level 9

@Reeza

Totally agree! Individually the summary data can all be calculated using Proc Freq, but the challenge is how to put everything nicely in a user-friendly format

FreelanceReinh
Jade | Level 19

Hello @zimcom,

 

Adverse event (AE) summary tables like this are very common in clinical research. That's why many pharmaceutical companies and CROs use macros to create them. So, in practice you would typically have such a macro available and use it without having to know the underlying macro code.

 

To verify some (or all) of the frequencies and percentages in the table, you can use PROC FREQ and (especially for the subject counts) PROC SQL. For code samples see, e.g., this PharmaSUG paper (p. 5-6), which covers this and other types of AE tables.

 

Depending on the desired table layout, the PROC REPORT code can be more or less complicated. For example, you may want to indent the preferred terms ("Atrial flutter" etc.) under their SOC name ("Cardiac disorders"), which can be achieved in different ways as is described in this WUSS paper.

zimcom
Pyrite | Level 9

@FreelanceReinh

Thanks for your reply.

I am working in a smal biotech company, there are no previous SAS code examples to follow. The clinical trial we are currently running is a blinded study and so I will have to change/update the Marco code in order to fit our situation.

 

Thank you very much again!

 

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 5 replies
  • 5997 views
  • 0 likes
  • 3 in conversation