BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
XiaoGuaiShou
Obsidian | Level 7

Hello all:

 

In a project, I need to make a table in SAS, I use these codes to achieve it, I did most of the job, unless one problem bothers me as following pictures.

 

Smiley Wink code I use:

data report;
infile datalines dlm=',';
informat rowvar finished male female;
input rowvar finished male female;
datalines;
1 ,1,20,40
1 ,1,60,40
2 ,1,40,40
3 ,1,60,20
3 ,1,40,0
3 ,1,60,20
4 ,1,30,0
5 ,1,0,20

;
run;

proc tabulate data =report style = [just=c vjust=m ];
classlev rowvar / style = [cellwidth=100];
class rowvar/ order=formatted preloadfmt;
keylabel all='Total';
var finished male/style= [background=#f6f5ef];
var finished female;

table rowvar=' ' all={S = {background = #E7E6D5}}*{S = {background = #E7E6D5 cellwidth=70}}
, finished='Respondents'*n=''*f=comma10.
mean="Gender"*(Male*{S = {background = #f6f5ef cellwidth=70}} Female)*f=10.1/ box={label="Department" s=[just=L ]} printmiss;
run;

 

Smiley Very HappyThe table I want:

Capture.PNG

 

Smiley IndifferentThe table I have:

Capture.PNG

 

 

 

 

It is almost there. However, I cannot come up with a solution to force the circle part to dark green, I can easily change it in Excel, but the situation is I need to make the report all completed by SAS.

 

Any help would be greatly appreciated.

 

Thanks,

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisNZ
Tourmaline | Level 20

Like this?

 

 

proc tabulate data=REPORT style = [just=c vjust=m ];
  classlev rowvar    / style = [cellwidth=100];
  class rowvar       / order = formatted preloadfmt;
  keylabel all='Total';
  var FINISHED MALE  / style = [background=#f6f5ef];
  var FEMALE;
  table ROWVAR  = ' ' 
        all     = {s={background = #e7e6d5}} * {s={background = #e7e6d5 cellwidth=70}} 
      , FINISHED= 'Respondents'*n=' '*f=comma10.
        mean    = "Gender"*(MALE*{s={background=#f6f5ef cellwidth=70}} FEMALE)*f=10.1
      / box={label="Department" s=[just=L ]} printmiss style_precedence=row;
run;

 

 

Capture.PNG

View solution in original post

2 REPLIES 2
ChrisNZ
Tourmaline | Level 20

Like this?

 

 

proc tabulate data=REPORT style = [just=c vjust=m ];
  classlev rowvar    / style = [cellwidth=100];
  class rowvar       / order = formatted preloadfmt;
  keylabel all='Total';
  var FINISHED MALE  / style = [background=#f6f5ef];
  var FEMALE;
  table ROWVAR  = ' ' 
        all     = {s={background = #e7e6d5}} * {s={background = #e7e6d5 cellwidth=70}} 
      , FINISHED= 'Respondents'*n=' '*f=comma10.
        mean    = "Gender"*(MALE*{s={background=#f6f5ef cellwidth=70}} FEMALE)*f=10.1
      / box={label="Department" s=[just=L ]} printmiss style_precedence=row;
run;

 

 

Capture.PNG

XiaoGuaiShou
Obsidian | Level 7
You are awesome! your solution is exactly what I needSmiley LOL

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 2 replies
  • 1455 views
  • 3 likes
  • 2 in conversation