You are here:

SAS/How to combine data in SAS

Advertisement


Question
Hello,

I have data as follows:
Year Sex  Cause  Death number  
2000 M    A1       10
2000 F    A1       11
2000 M    A3       12
2001 M    A1       15
2001 F    A2       16

I want to combine all death numbers by year as follows:
Year     Death number  
2000          33
2001          31

How can I write the program in SAS? I am sorry for simplequestion but I am very new user of SAS.
Thanks in advance.

Answer
Dear Odko,
Thank you for posting me the question. Wish you a very happy new year!

You could write code like this

Proc Sql;
Select year, sum(death_number) as death_number
From YourData
Group by year
Order by year
;
Quit;

Or

Proc means data=YourData sum Nway;
Class year;
Var death_number;
Run;

Hope this would help. Let me know if you need any more help.

Regards,

SAS

All Answers


Answers by Expert:


Ask Experts

Volunteer


Ariful Mondal

Expertise

BASE SAS, SAS Macros, SAS Automation, SAS STAT, ANALYTICS PACKAGE, DDE, X-Commands, System Functions etc.

Experience

I have been using SAS for more than 7 years.

Organizations
MarketRx, Global Analytics, Morgan Stanley, HSBC

Education/Credentials
Masters in Applied Statistics and Informatics from IIT Bombay. Hons. in Statistics

©2016 About.com. All rights reserved.