%let gpath='.';
ods html close;
%let dpi=200;
ods listing gpath=&gpath image_dpi=&dpi;
data colleges;
format Value percent5.0;
length Category $30 Group $30;
infile datalines delimiter=',';
input Category $ Group $ Value;
Label=strip(group) || ':' || put(value, percent5.0);
datalines;
Gender, Female, 0.54
Gender, Male, 0.46
Age, 17-21, 0.53
Age, 22-29, 0.27
Age, 30+, 0.20
Type of^School, 4-year, 0.60
Type of^School, 2-year, 0.40
Race, White, 0.58
Race, Hispanic, 0.17
Race, Black, 0.15
Race, Other, 0.10
Enrollment, Full-time, 0.63
Enrollment, Part-time, 0.37
Employment, Part-time, 0.36
Employment, Full-time, 0.26
Employment, Not employed, 0.38
Financial^Aid, No Pell Grants, 0.61
Financial^Aid, Pell Grants, 0.39
Housing, On campus, 0.41
Housing, With parent, 0.10
Housing, Other housing, 0.49
Dependents, No children, 0.72
Dependents, Have children, 0.28
Learning^Environment, Classroom, 0.73
Learning^Environment, Online, 0.13
Learning^Environment, Blend, 0.14
run;
ods html;
proc print data=colleges(obs=6);
var Category Group Value Label;
run;
ods html close;
/*--Compute location of each segment label--*/
data labels;
length prev $30;
retain val 0 prev '' Resp 0;
set colleges;
if category ne prev then do;
val=0;
Lbl_Loc=val+value/2;
prev=category;
val=val+value;
Resp=Resp+1;
end;
else do;
Lbl_Loc=val+value/2;
val=val+value;
end;
run;
ods html;
proc print data=labels(obs=6);
var Category Group Value Label Lbl_Loc Resp;
run;
ods html close;
/*--Likert Graph with Values and Labels--*/
ods listing gpath=&gpath image_dpi=&dpi;
ods graphics / reset noborder width=6in height=4in imagename="Likert_Label";
title "America As College Students";
proc sgplot data=labels noautolegend subpixel nocycleattrs noborder;
hbarparm category=category response=value / group=group dataskin=crisp barwidth=1;
text y=category x=Lbl_Loc text=label / contributeoffsets=none textattrs=(size=7);
xaxis display=(nolabel noticks noline);
yaxis display=(nolabel noticks noline) fitpolicy=splitalways splitchar='^';
run;
/*--Likert Graph with Values and Labels with Gradient and fill type--*/
ods listing gpath=&gpath image_dpi=&dpi;
ods graphics / reset noborder width=6in height=4in imagename="Likert_Grad";
title "America As College Students";
proc sgplot data=labels noautolegend subpixel nocycleattrs noborder;
hbarparm category=category response=value / group=group colorresponse=resp
colormodel=(forestgreen gold maroon violet) dataskin=crisp
barwidth=1 transparency=0.4 filltype=gradient;
text y=category x=Lbl_Loc text=label / contributeoffsets=none textattrs=(size=7);
xaxis display=(nolabel noticks noline);
yaxis display=(nolabel noticks noline) fitpolicy=splitalways splitchar='^';
run;
/*--Likert Icon--*/
%let dpi=100;
ods listing gpath=&gpath image_dpi=&dpi;
ods graphics / reset noborder width=2.7in height=1.8in imagename="Likert_Icon";
title "America As College Students";
proc sgplot data=labels noautolegend subpixel nocycleattrs noborder;
hbarparm category=category response=value / group=group colorresponse=resp
colormodel=(forestgreen gold maroon violet) dataskin=crisp
barwidth=1 transparency=0.4 filltype=gradient;
text y=category x=Lbl_Loc text=label / contributeoffsets=none textattrs=(size=7);
xaxis display=(nolabel noticks noline);
yaxis display=(nolabel noticks noline) fitpolicy=splitalways splitchar='^';
run;