BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
DanielP91
Fluorite | Level 6

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

DanielP91_0-1678168161676.png

 

What I am trying to achieve and am having issues coding this is below:

DanielP91_2-1678168201105.png

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. 

.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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;

 

 

View solution in original post

2 REPLIES 2
ballardw
Super User

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;

 

 

DanielP91
Fluorite | Level 6

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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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