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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 785 views
  • 3 likes
  • 2 in conversation