Hello
In need of some help regarding proc tabulate and how to format my output a certain way.
My current code:
ods _all_ close;
ods excel file="E:\Users\Daniel Paredes\ALLPCLEVELS.xlsx";
proc tabulate data=final style=minimal format=comma6.;
class User District / order=data s=[font_weight=bold];
var Email--Progressing;
table User*District all ='Average'*f=6.2,
Email--Progressing*mean=' '/s=[font_weight=light font_size=6] nocellmerge;
run;
ods excel close;
ods listing;
My current codes output image below
What I am trying to achieve and am having issues coding this is below:
I would like my new tabulate report to have a heading called 'PC Actions Taken' above the columns Email to Other with a sum of those columns called 'Total Action Taken'. And a heading called 'PC Level of Contact' above columns High to Progressing with a sum of those columns called 'Total Levels of Contact'.
Your help and suggestions would be greatly appreciated.
I've also attached the spreadsheet with the example sheets.
.
Many users here don't want to download Excel files because of virus potential, others have such things blocked by security software or organization policy. Also if you give us Excel we have to create a SAS data set and due to the non-existent constraints on Excel data cells the result we end up with may not have variables of the same type (numeric or character) and even values.
It helps to post code into a text box opened with the </> icon above the message window to preserve formatting and to set the code apart from question text.
Place the statistic request before the variable names and override the statistic label
proc tabulate data=final style=minimal format=comma6.; class User District / order=data s=[font_weight=bold]; var Email--Progressing; table User*District all ='Average'*f=6.2, mean='Total Action Taken'/s=[font_weight=light font_size=6]* ( Email--Other) mean='PC Level of Contact'/s=[font_weight=light font_size=6]* ( High--Processing) ; run;
Many users here don't want to download Excel files because of virus potential, others have such things blocked by security software or organization policy. Also if you give us Excel we have to create a SAS data set and due to the non-existent constraints on Excel data cells the result we end up with may not have variables of the same type (numeric or character) and even values.
It helps to post code into a text box opened with the </> icon above the message window to preserve formatting and to set the code apart from question text.
Place the statistic request before the variable names and override the statistic label
proc tabulate data=final style=minimal format=comma6.; class User District / order=data s=[font_weight=bold]; var Email--Progressing; table User*District all ='Average'*f=6.2, mean='Total Action Taken'/s=[font_weight=light font_size=6]* ( Email--Other) mean='PC Level of Contact'/s=[font_weight=light font_size=6]* ( High--Processing) ; run;
Thanks ballarddw your suggested code has worked. Appreciate that.
Also, will make a note the information you provide for future reference. A little new to this community and still finding my way around 🙂
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.