I have the following data set like this :
Group_Name | Head_Name | LastYear_Count | BeforeLastYear_Count |
R&D | IT | 1 | 2 |
R&D | Testing | 0 | 5 |
R&D | Production | 4 | 0 |
R&D | Development | 1 | 0 |
Sales | Book | 5 | 4 |
Sales | Product | 10 | 0 |
Sales | Kit | 1 | 1 |
Admin | Marketing | 4 | 1 |
Admin | HR | 5 | 2 |
Admin | Project | 6 | 3 |
and I want to get the output like the following attachment using proc report.:
HI,
data test;
input Group_Name $ Head_Name $ LastYear_Count BeforeLastYear_Count;
cards;
R&D IT 1 2
R&D Testing 0 5
;
run;
proc report data=test style(header)=[background=white];
col ('Groups ' Group_Name Head_Name)
('total count' LastYear_Count BeforeLastYear_Count );
run;
Thanks,
HI,
data test;
input Group_Name $ Head_Name $ LastYear_Count BeforeLastYear_Count;
cards;
R&D IT 1 2
R&D Testing 0 5
;
run;
proc report data=test style(header)=[background=white];
col ('Groups ' Group_Name Head_Name)
('total count' LastYear_Count BeforeLastYear_Count );
run;
Thanks,
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.