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.
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;
The table I want:
The table I have:
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,
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;
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;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.