%let gpath='.';
%let dpi=200;
ods html close;
ods listing gpath=&gpath image_dpi=&dpi;
/*--Lawyers--*/
data Law_Salaries;
input Profession $1-25 Salary;
format salary dollar10.0;
datalines;
District Court Judges 165200
Senior Professors 330000
Law School Deans 430000
;
run;
proc print;run;
/*--Alpha Gradient Grouped Bar Chart with Bar Labels--*/
title h=16pt 'Comparison of 2006 Salaries';
ods graphics / reset width=5in height=3in imagename='Law_Gradient';
proc sgplot data=Law_Salaries nowall noborder noautolegend;
styleattrs datacolors=(red gold green) datacontrastcolors=(black);
vbar profession / response=salary group=profession groupdisplay=cluster
filltype=gradient baselineattrs=(thickness=0)
datalabel datalabelattrs=(size=14);
xaxis discreteorder=data display=(noticks nolabel noline);
yaxis display=(noticks nolabel noline) grid;
run;
/*--Opaque Gradient Grouped Bar Chart with Bar Labels--*/
ods graphics / reset width=5in height=3in imagename='Law_White_Gradient';
proc sgplot data=Law_Salaries nowall noborder noautolegend;
styleattrs datacolors=(red gold green) datacontrastcolors=(black);
vbar profession / response=salary group=profession groupdisplay=cluster
fillattrs=(color=white) baselineattrs=(thickness=0);
vbar profession / response=salary group=profession groupdisplay=cluster
filltype=gradient baselineattrs=(thickness=0)
datalabel datalabelattrs=(size=14);
xaxis discreteorder=data display=(noticks nolabel noline);
yaxis display=(noticks nolabel noline) grid;
run;
/*--Opaque gradient with skin--*/
ods graphics / reset width=5in height=3in imagename='Law_White_Gradient_Skin';
proc sgplot data=Law_Salaries nowall noborder noautolegend;
styleattrs datacolors=(red gold green) datacontrastcolors=(black);
vbar profession / response=salary group=profession groupdisplay=cluster barwidth=0.8
fillattrs=(color=white) baselineattrs=(thickness=0);
vbar profession / response=salary group=profession groupdisplay=cluster barwidth=0.8
filltype=gradient dataskin=pressed baselineattrs=(thickness=0)
datalabel datalabelattrs=(size=14);
xaxis discreteorder=data display=(noticks nolabel noline);
yaxis display=(noticks nolabel noline) grid;
run;
/*--Gradient to black Grouped Bar Chart--*/
ods graphics / reset width=5in height=3in imagename='Law_Black_Gradient';
proc sgplot data=Law_Salaries nowall noborder noautolegend;
styleattrs datacolors=(red gold green) datacontrastcolors=(black);
vbar profession / response=salary group=profession groupdisplay=cluster barwidth=0.8
fillattrs=(color=black) baselineattrs=(thickness=0);
vbar profession / response=salary group=profession groupdisplay=cluster barwidth=0.8
fillattrs=(transparency=0.7) baselineattrs=(thickness=0);
vbar profession / response=salary group=profession groupdisplay=cluster filltype=gradient
datalabel datalabelattrs=(size=14);
xaxis discreteorder=data display=(noticks nolabel noline);
yaxis display=(noticks nolabel noline) grid;
run;
/*--Gradient to black Grouped Bar Chart Skin=Pressed--*/
ods graphics / reset width=5in height=3in imagename='Law_Black_Gradient_Skin';
proc sgplot data=Law_Salaries nowall noborder noautolegend;
styleattrs datacolors=(red gold green) datacontrastcolors=(black);
vbar profession / response=salary group=profession groupdisplay=cluster barwidth=0.8
fillattrs=(color=black) baselineattrs=(thickness=0);
vbar profession / response=salary group=profession groupdisplay=cluster barwidth=0.8
fillattrs=(transparency=0.7) baselineattrs=(thickness=0);
vbar profession / response=salary group=profession groupdisplay=cluster barwidth=0.8
filltype=gradient dataskin=pressed baselineattrs=(thickness=0)
datalabel datalabelattrs=(size=14);
xaxis discreteorder=data display=(noticks nolabel noline);
yaxis display=(noticks nolabel noline) grid;
run;
/*--Gradient to black Grouped Bar Chart Skin=Matte--*/
ods graphics / reset width=5in height=3in imagename='Law_Black_Gradient_Matte';
proc sgplot data=Law_Salaries nowall noborder noautolegend;
styleattrs datacolors=(red gold green) datacontrastcolors=(black);
vbar profession / response=salary group=profession groupdisplay=cluster barwidth=0.8
fillattrs=(color=black) baselineattrs=(thickness=0);
vbar profession / response=salary group=profession groupdisplay=cluster barwidth=0.8
fillattrs=(transparency=0.7) baselineattrs=(thickness=0);
vbar profession / response=salary group=profession groupdisplay=cluster barwidth=0.8
filltype=gradient dataskin=matte baselineattrs=(thickness=0)
datalabel datalabelattrs=(size=14);
xaxis discreteorder=data display=(noticks nolabel noline);
yaxis display=(noticks nolabel noline) grid;
run;
title;
/*--Psychologists--*/
data Psy_Salaries;
input Profession $1-30 Experience $31-40 Salary;
if salary ne 0 then label=put(salary/1000,2.0) || 'k' || 'A0'x;
zero=0;
datalines;
Psychologist <1 Year 48000
Psychologist 5 Years 63000
Psychologist 10 Years 69000
Marriage & Family Therapist <1 Year 37000
Marriage & Family Therapist 5 Years 48000
Marriage & Family Therapist 10 Years 53000
School Psychologist <1 Year 46000
School Psychologist 5 Years 55000
School Psychologist 10 Years 61000
Organizational Psychologist <1 Year 49000
Organizational Psychologist 5 Years 80000
Organizational Psychologist 10 Years 97000
Social Worker <1 Year 35000
Social Worker 5 Years 41000
Social Worker 10 Years 44000
;
run;
proc print;run;
/*--Grouped Bar Chart with Text Bar Labels--*/
title h=14pt 'Average Salaries by Experience';
ods graphics / reset width=5in height=3in imagename='Pys_Salaries_1';
proc sgplot data=Psy_Salaries nowall noborder noautolegend
pad=(left=10pct right=10pct);
styleattrs datacolors=(darkblue cx4f4f4f black) datacontrastcolors=(black black black);
vbarparm category=profession response=salary / group=experience groupdisplay=cluster
filltype=gradient baselineattrs=(thickness=0)
clusterwidth=0.6 barwidth=0.8 name='a';
text x=profession y=salary text=label / group=experience groupdisplay=cluster
clusterwidth=0.6 rotate=90 position=left textattrs=(color=white);
xaxis discreteorder=data display=(nolabel noticks noline);
yaxis display=none grid offsetmin=0;
keylegend 'a' / location=inside position=top noborder;
run;
/*--Grouped Bar Chart with Text Bar Labels and transision to black--*/
title h=14pt 'Average Salaries by Experience';
ods graphics / reset width=5in height=3in imagename='Pys_Salaries_2';
proc sgplot data=Psy_Salaries nowall noborder noautolegend
pad=(left=10pct right=10pct);
styleattrs datacolors=(lightblue grey white) datacontrastcolors=(black black black);
vbarparm category=profession response=salary / group=experience groupdisplay=cluster
fillattrs=(color=cx2f2f2f) baselineattrs=(thickness=0)
clusterwidth=0.6 barwidth=0.8;
vbarparm category=profession response=salary / group=experience groupdisplay=cluster
filltype=gradient baselineattrs=(thickness=0)
clusterwidth=0.6 barwidth=0.8 name='a';
text x=profession y=salary text=label / group=experience groupdisplay=cluster
clusterwidth=0.6 rotate=90 position=left textattrs=(color=white) backlight;
xaxis discreteorder=data display=(nolabel noticks noline);
yaxis display=none grid offsetmin=0;
keylegend 'a' / location=inside position=top noborder;
run;
/*--Final Bar Chart with adjascent category labels--*/
title h=14pt 'Average Salaries by Experience';
ods graphics / reset width=5in height=3in imagename='Pys_Salaries_3';
proc sgplot data=Psy_Salaries nowall noborder noautolegend
pad=(left=10pct right=10pct);
styleattrs datacolors=(lightblue grey white) datacontrastcolors=(black black black);
vbarparm category=profession response=salary / group=experience groupdisplay=cluster
fillattrs=(color=black) baselineattrs=(thickness=0)
discreteoffset=0.2 clusterwidth=0.6 barwidth=0.8;
vbarparm category=profession response=salary / group=experience groupdisplay=cluster
filltype=gradient baselineattrs=(thickness=0) dataskin=pressed
discreteoffset=0.2 clusterwidth=0.6 barwidth=0.8 name='a';
text x=profession y=salary text=label / group=experience groupdisplay=cluster clusterwidth=0.6
discreteoffset=0.2 rotate=90 position=left textattrs=(color=black) backlight;
text x=profession y=zero text=profession / rotate=90 position=right textattrs=(size=12 color=darkblue)
contributeoffsets=none discreteoffset=-0.2;
xaxis discreteorder=data display=none;
yaxis display=none grid;
keylegend 'a' / location=inside position=top noborder;
run;